note 124957 added to function.array-map

From: Date: Tue, 28 Apr 2020 00:57:14 +0000
Subject: note 124957 added to function.array-map
Groups: php.notes 
Request: Send a blank email to php-notes+get-214549@lists.php.net to get a copy of this message
ExampleArrow function php >= 7.4 Short closures, also called arrow functions, are a way of writing shorter functions in PHP. This notation is useful when passing closures to functions like array_map or array_filter <?php $request = [ ['value'=>1], ['value'=>2], ['value'=>3], ]; print_r( array_map(fn(array $value)=>$value['value'],$request) ); ?> Output: Array ( [0] => 1 [1] => 2 [2] => 3 ) ---- Server IP: 45.112.84.4 Probable Submitter: 38.142.137.34 (proxied: 187.60.138.212) ---- Manual Page -- http://php.net/manual/en/function.array-map.php Edit -- https://master.php.net/note/edit/124957 Del: integrated -- https://master.php.net/note/delete/124957/integrated Del: useless -- https://master.php.net/note/delete/124957/useless Del: bad code -- https://master.php.net/note/delete/124957/bad+code Del: spam -- https://master.php.net/note/delete/124957/spam Del: non-english -- https://master.php.net/note/delete/124957/non-english Del: in docs -- https://master.php.net/note/delete/124957/in+docs Del: other reasons-- https://master.php.net/note/delete/124957 Reject -- https://master.php.net/note/reject/124957 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214549) next »