response->docs);
?>
Outputs the following:
Array
(
[0] => Object
(
I ran into an issue with Andy Earnshaw's answer because I had factored this function out to a separate class within my application, "HelperFunctions", which meant the recursive call to objectToArray() failed.
I overcame this by specifying the class name within the array_map call like so:
public function objectToArray($object) {
if (!is_object($object) && !is_array($object))
return $object;
return array_map(array("HelperFunctions", "objectToArray"), (array) $object);
}
I would have written this in the comments but I don't have enough reputation yet.