Array remove empty entries PHP
By admin • Mar 18th, 2010 • Category: Web ProgrammingBellow PHP code for remove an empty value of array:
function array_remove_empty($arr){
$narr = array();
while(list($key, $val) = each($arr)){
if (is_array($val)){
$val = array_remove_empty($val);
// does the result array contain anything?
if (count($val)!=0){
// yes ![]()
$narr[$key] = $val;
}
}
else {
if (trim($val) != ""){
$narr[$key] = $val;
}
}
}
unset($arr);
return $narr;
}
admin is
Email this author | All posts by admin



makasih scriptnya, saya sedang membutuhkan fungsi remove an empty value.