note 72465 deleted from function.array-walk by danbrown
| From: | danbrown@php.net | Date: | Thu, 28 Oct 2010 16:18:53 +0000 |
| Subject: | note 72465 deleted from function.array-walk by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173564@lists.php.net to get a copy of this message | ||
Note Submitter: Jon Langevin >>intel352 : AT : gmail.com
----
In response to "Andrzej Martynowicz at gmail dot com", regarding the use of array_walk
with the optional 3rd parameter being modified by reference:
while your solution works, yet another option is to call array_walk like so:
<?php
array_walk($array1, 'userfunction', &$array2byreference);
function userfunction(&$array1value, $key, $array2){
// process $array1value and $array2, $array2 will retain the values
}
?>