PHP function to convert stdClass Objects to Multidimensional Arrays
<?phpfunction object2array($myobj) {
if (is_object($myobj)) {
$myobj = get_object_vars($myobj);
}
if (is_array($myobj)) {
return array_map(__FUNCTION__, $myobj);
}
else {
return $myobj;
}
}
?>
No comments:
Post a Comment