一些简单的对象与数组的相互转换的问题,采用递归写了两个方法如下
1 2 3 4 5 6 7 8  |  function arrayToObject($e){         if( gettype($e)!=‘array‘ ) return;     foreach($e as $k=>$v){         if( gettype($v)==‘array‘ || getType($v)==‘object‘ )                $e[$k]=(object)arrayToObject($v);     }        return (object)$e; } | 
1 2 3 4 5 6 7 8 9  |  function objectToArray($e){    $e=(array)$e;    foreach($e as $k=>$v){        if( gettype($v)==‘resource‘ ) return;        if( gettype($v)==‘object‘ || gettype($v)==‘array‘ )            $e[$k]=(array)objectToArray($v);    }    return $e; } | 
原文:http://www.cnblogs.com/vlone/p/4590695.html