note 34379 deleted from function.array-walk by aidan

From: Date: Sun, 11 Jul 2004 02:08:49 +0000
Subject: note 34379 deleted from function.array-walk by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73030@lists.php.net to get a copy of this message
Note Submitter: phpContrib (A T) esurfers d o t c o m ---- You can make it go through multi-dimensional arrays! Just write the callback to do so. Such as: function test_alter (&$item1, $key, $prefix) { if(is_array($item1)) { array_walk ($item1, 'test_alter', 'fruit'); return; } $item1 = "$prefix: $item1"; } If an item of the array is itself an array, it will call array_walk() with the same callback on the sub-array. ALERT! This is not tested code, it is just to give an idea, it "should" be correct, but I may have missed details...

« previous php.notes (#73030) next »