/**
* 對象轉換爲數組
* @param 須要轉換的數組 $array
* @return array
*/
function object_array($array) {
if(is_object($array)) {
$array = (array)$array;
} if(is_array($array)) {
foreach($array as $key=>$value) {
$array[$key] = $this->object_array($value);
}
}
return $array;
}
function objarray_to_array($obj) {
$ret = array();
foreach ($obj as $key => $value) {
if (gettype($value) == "array" || gettype($value) == "object"){
$ret[$key] = objarray_to_array($value);
}else{
$ret[$key] = $value;
}
}
return $ret;
}數組