note 43755 added to function.array-map

From: Date: Fri, 02 Jul 2004 08:07:01 +0000
Subject: note 43755 added to function.array-map
Groups: php.notes 
Request: Send a blank email to php-notes+get-72311@lists.php.net to get a copy of this message
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); ?> ---- Manual Page -- http://www.php.net/manual/en/function.array-map.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43755 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43755&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43755&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#72311) next »