note 129138 added to function.array-walk

From: Date: Wed, 03 Jan 2024 21:47:55 +0000
Subject: note 129138 added to function.array-walk
Groups: php.notes 
Request: Send a blank email to php-notes+get-221092@lists.php.net to get a copy of this message
This function can be used to add the values in one array to another: <?php echo '<pre>'; // example code $a = [ 1, 2, 3, 4, 5, 6]; $c = [10,20,30,40,50,60]; array_walk($a, function(&$item, $key, $y) { $item += $y[$key];}, $c ); print_r($a); // result Array ( [0] => 11 [1] => 22 [2] => 33 [3] => 44 [4] => 55 [5] => 66 ) ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 83.97.87.23) ---- Manual Page -- https://php.net/manual/en/function.array-walk.php Edit -- https://main.php.net/note/edit/129138 Del: integrated -- https://main.php.net/note/delete/129138/integrated Del: useless -- https://main.php.net/note/delete/129138/useless Del: bad code -- https://main.php.net/note/delete/129138/bad+code Del: spam -- https://main.php.net/note/delete/129138/spam Del: non-english -- https://main.php.net/note/delete/129138/non-english Del: in docs -- https://main.php.net/note/delete/129138/in+docs Del: other reasons-- https://main.php.net/note/delete/129138 Reject -- https://main.php.net/note/reject/129138 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221092) next »