Revision: 56444
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 28, 2012 20:02 by jgomez
Initial Code
function objectToArray($object) { if(!is_object( $object ) && !is_array( $object )) { return $object; } if(is_object($object) ) { $object = get_object_vars( $object ); } return array_map('objectToArray', $object ); }
Initial URL
http://www.sitepoint.com/forums/showthread.php?438748-convert-object-to-array
Initial Description
If you want to use this in a class, change the last line to: ` return array_map(array($this, __FUNCTION__), $object ); `
Initial Title
objectToArray Part 2
Initial Tags
php, object, array, function
Initial Language
PHP