note 129137 added to function.array-map

From: Date: Wed, 03 Jan 2024 21:28:01 +0000
Subject: note 129137 added to function.array-map
Groups: php.notes 
Request: Send a blank email to php-notes+get-221091@lists.php.net to get a copy of this message
This function along with array_sum can be used to calculate the sum of any number of arrays in a very concise manner: <?php $a = [ 1, 2, 3, 4, 5, 6]; $b = [ 0, 1, 2, 3, 4, 5]; $c = [10,20,30,40,50,60]; $d = array_map( fn() => array_sum(func_get_args()), $a, $b, $c ); print_r($d); // Result Array ( [0] => 11 [1] => 23 [2] => 35 [3] => 47 [4] => 59 [5] => 71 ) ?> ---- 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-map.php Edit -- https://main.php.net/note/edit/129137 Del: integrated -- https://main.php.net/note/delete/129137/integrated Del: useless -- https://main.php.net/note/delete/129137/useless Del: bad code -- https://main.php.net/note/delete/129137/bad+code Del: spam -- https://main.php.net/note/delete/129137/spam Del: non-english -- https://main.php.net/note/delete/129137/non-english Del: in docs -- https://main.php.net/note/delete/129137/in+docs Del: other reasons-- https://main.php.net/note/delete/129137 Reject -- https://main.php.net/note/reject/129137 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221091) next »