note 14014 deleted from function.array-filter by didou
| From: | didou@php.net | Date: | Mon, 26 Jan 2004 10:03:15 +0000 |
| Subject: | note 14014 deleted from function.array-filter by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64197@lists.php.net to get a copy of this message | ||
Note Submitter: fgilles at free dot fr
----
dub4u, your function doesn't truly replace array_filter() because it doesn't restore
originals $array keys.
Here is a replacement for array_filter() for PHP4 < 4.0.6:
function array_filter_it($array, $callback)
{
$farray = array ();
while(list($key,$val) = each($array))
if ($callback($val))
$farray[$key] = $val;
return $farray;
}