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
;
}
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/jaiho/archive/2011/05/17/2049369.html转载请注明原始链接。