Ec (2); $ fangIdPostGet (houseId); get the address bar value $ tempArrayarray_filter (explode (_, $ fangId), & quot; filter & quot ;); divide the array into _ and delete the empty array if (is_array ($ tempArray) & amp ;! Empty ($
Php deletes an empty array
$ FangId = PostGet ('houseid'); // obtain the address bar value $ tempArray = array_filter (explode ('_', $ fangId), "filter "); // use _ as an array and delete the empty array if (is_array ($ tempArray )&&! Empty ($ tempArray) // checks whether the array has a value {print_r ($ tempArray); // test the output} else {MessAge ('select compare real estate ', 'list. php ');}/* function filter ($ var) processing function {if ($ var = '') {return false;} return true ;}*/
Test method:/compare. php? HouseId = 2306425230742523031042308
Method 2
function array_to_hashmap(& $arr, $keyField, $valueField = null) { $ret = array(); if($valueField) { foreach ($arr as $row) { $ret[$row[$keyField]] = $row[$valueField]; } } else { foreach($arr as $row) { $ret[$row[$keyField]] = $row; } } return $ret; }
The above is the content for php to delete an empty array. For more information, see PHP Chinese Network (www.php1.cn )!