Skip to content

Instantly share code, notes, and snippets.

@abedsujan
Created February 6, 2012 01:03
Show Gist options
  • Save abedsujan/1748740 to your computer and use it in GitHub Desktop.
Save abedsujan/1748740 to your computer and use it in GitHub Desktop.
Convert Object class to Array
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 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment