How can I convert an array like this to an object?
[128] => Array ( [status] => "Figure A. Facebook\'s horizontal scrollbars showing u
use this function that i've made:
function buildObject($class,$data){ $object = new $class; foreach($data as $key=>$value){ if(property_exists($class,$key)){ $object->{'set'.ucfirst($key)}($value); } } return $object; }
Usage:
$myObject = buildObject('MyClassName',$myArray);