Skip to content

Instantly share code, notes, and snippets.

@bondarewicz
Last active December 11, 2015 13:08
Show Gist options
  • Save bondarewicz/4605507 to your computer and use it in GitHub Desktop.
Save bondarewicz/4605507 to your computer and use it in GitHub Desktop.
PHP: Deep Convert object to array
//object to array deep conversion
function object2array( $o )
{
$a = (array) $o;
foreach( $a as &$v )
{
if( is_object( $v ) )
{
$v = object2array( $v );
}
}
return $a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment