note 43755 deleted from function.array-map by philip
| From: | philip@php.net | Date: | Thu, 22 Feb 2007 02:03:02 +0000 |
| Subject: | note 43755 deleted from function.array-map by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123695@lists.php.net to get a copy of this message | ||
Note Submitter: nd0 at gmx.de
----
Here's an other example, to handle array of arrays with array_map.
Only a small modification in the callback-function.
<?php
function cube($n) {
if (is_array($n)) return array_map('cube', $n);
return $n*$n*$n;
}
$a = array(1, 2, array(3, 4, array(5)));
$b = array_map('cube', $a);
print_r($b);
?>