检查这个:
function print_array($array,$depth=1,$indentation=0){
if (is_array($array)){
echo "Array(\n";
foreach ($array as $key=>$value){
if(is_array($value)){
if($depth <= 0){
echo "max depth reached.";
}
else{
for($i=0;$i<$indentation;$i++){
echo " ";
}
echo $key."=Array(";
print_array($value,$depth-1,$indentation+1);
for($i=0;$i<$indentation;$i++){
echo " ";
}
echo ");";
}
}
else{
for($i=0;$i<$indentation;$i++){
echo " ";
}
echo $key."=>".$value."\n";
}
}
echo ");\n";
}
else{
echo "It is not an array\n";
}
}