note 96547 deleted from function.array-filter by danbrown
| From: | danbrown@php.net | Date: | Thu, 04 Mar 2010 15:17:20 +0000 |
| Subject: | note 96547 deleted from function.array-filter by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-166653@lists.php.net to get a copy of this message | ||
Note Submitter: thomas at tourlourat dot com
----
An other way to have a recursive feature
<?php
$numbers = array (1, 2, 3, 4, 5, 6, array (7, 8, 9, 10));
function isOdd (&$value)
{
if (is_array ($value))
{
$value = array_filter ($value, "isOdd");
return true;
}
else
return ($value & 1);
}
$numbers_clean = array_filter ($numbers, "isOdd");
echo $numbers_clean
?>