Array veya Object Dönüştürme

Array Örnek
$data=Array([ad] => phpstate);
Object Örnek
$data=stdClass Object([ad] => phpstate);

<?php 
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;
}

////////////////////////////////////////////////////
function array_to_object($data)
{
    if (is_array($data) || is_object($data))
    {
				$result= new stdClass();
				foreach ($data as $key => $value)
				{
				$result->$key = array_to_object($value);
      }
        return $result;
    }
    return $data;
}
?>

Sizin Değerli Görüşlerinize İhtiyacımız Var.