note 15566 deleted from function.array-filter by jimw
| From: | jimw@php.net | Date: | Tue, 18 Dec 2001 20:17:56 +0000 |
| Subject: | note 15566 deleted from function.array-filter by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23195@lists.php.net to get a copy of this message | ||
if you want to filter and lose key information (condense the length of the array)
then use
function array_filter_it($array, $callback)
{
$farray = array ();
while(list($key,$val) = each($array))
if ($callback($val))
$farray[] = $val;
return $farray;
}
That is the same as the previous users Note except The $key is removed so that PHP picks the next
number in the array instead of its original key