filtering an array

A

Anonymous

Guest
Is there a function that will filter out all empty nodes of an array?
 
as posted from http://www.php.net/array_filter
Code:
function array_delete($array, $filterfor){
$thisarray = array ();
 foreach($array as $value)
  if(stristr($value, $filterfor)===false && strlen($value)>0)
    $thisarray[] = $value;
 return $thisarray;
}

$array1 = array ('OtHeR','this', 'that', 'Other','', 9, 101, 'fifty', 'other','','');

echo "<pre>array :\n";
print_r($array1);

$array2=array_delete($array1, "Other");

echo "filtered:\n";
print_r($array2);
 
Back
Top