php去除多维数组中的空值
$arr1,"1"=>$arr2,"2"=>$arr3); $s_arr2 = array("0"=>$arr4,"1"=>$arr5,"2"=>$arr6); $s_arr3 = array("0"=>$arr7,"1"=>$arr8,"2"=>$arr9); $big_arr = array("0"=>$s_arr1,"1"=>$s_arr2,"2"=>$s_arr3); $g_arr = get_arr($big_arr); print_r($g_arr); function get_arr($arr) { foreach ($arr as $k=>$v) { if(is_array($arr[$k])) { $arr[$k] = get_arr($arr[$k]); } else { if(empty($arr[$k])) { unset($arr[$k]); } } } return $arr; } ?>
文章题目:php去除多维数组中的空值
地址分享:http://scyanting.com/article/ijjccd.html