Create object to array after json decode

After taking a few look at json encode, it looks like after I decode with json decode it becomes object, so after json_decode all array becomes obj to overcome this need the function below...


function object_to_array($data)
{
if (is_array($data) || is_object($data))
{
$result = array();
foreach ($data as $key => $value)
{
$result[$key] = object_to_array($value);
}
return $result;
}
return $data;
}