Php Object to Array
Its more easy to parse and access and array than a object
Here is the function
//Function returns array by a SimpleXmlObject
function object2array($object){
$return = NULL;
if(is_array($object))
{
foreach($object as $key => $value)
$return[$key] = object2array($value);
}
else
{
$var = get_object_vars($object);
if($var)
{
foreach($var as $key => $value)
$return[$key] = ($key && !$value) ? NULL : object2array($value);
}
else return $object;
}
return $return;
}
By : Motyar+ @motyar