be careful with the above function "array_delete"'s use of the stristr function, it could be slightly misleading. consider the following:
<?php
function array_delete($array, $filterforsubstring){
$thisarray = array ();
foreach($array as $value)
if(stristr($value, $filterforsubstring)===false && strlen($value)>0)
$thisarray[] = $value;
return $thisarray;
}
function array_delete2($array, $filterforstring, $removeblanksflag=0){
$thisarray = array ();
foreach($array as $value)
if(!(stristr($value, $filterforstring) && strlen($value)==strlen($filterforstring))
&& !(strlen($value)==0 && $removeblanksflag))
$thisarray[] = $value;
return $thisarray;
}
function array_delete3($array, $filterfor, $substringflag=0, $removeblanksflag=0){
$thisarray = array ();
foreach($array as $value)
if(
!(stristr($value, $filterfor)
&& ($substringflag || strlen($value)==strlen($filterfor))
)
&& !(strlen($value)==0 && $removeblanksflag)
)
$thisarray[] = $value;
return $thisarray;
}
$array1 = array ('the OtHeR thang','this', 'that', 'OtHer','', 9, 101, 'fifty', ' oTher', 'otHer ','','other','Other','','other blank things');
echo "<pre>array :\n";
print_r($array1);
$array2=array_delete($array1, "Other");
echo "array_delete(\$array1, \"Other\"):\n";
print_r($array2);
$array2=array_delete2($array1, "Other");
echo "array_delete2(\$array1, \"Other\"):\n";
print_r($array2);
$array2=array_delete2($array1, "Other",1);
echo "array_delete2(\$array1, \"Other\",1):\n";
print_r($array2);
$array2=array_delete3($array1, "Other",1);
echo "array_delete3(\$array1, \"Other\",1):\n";
print_r($array2);
$array2=array_delete3($array1, "Other",0,1);
echo "array_delete3(\$array1, \"Other\",0,1):\n";
print_r($array2);
?>