Generally we sometimes we got stuck while doing coding. I used this function to easily converting object into array if needed. Hope it will help to someone else.
if(is_array($object) || is_object($object)){
$array = array();
foreach($object as $key => $value){
$array[$key] = object_to_array($value);
}
return $array;
}
return $object;
}
Leave a comment