note 116929 added to function.array-filter

From: Date: Mon, 23 Mar 2015 03:33:46 +0000
Subject: note 116929 added to function.array-filter
Groups: php.notes 
Request: Send a blank email to php-notes+get-202011@lists.php.net to get a copy of this message
Caution: If the array is changed from the callback function (e.g. element added, deleted or unset) the behavior of this function is undefined. I tested this with PHP 5.5.3. $test = array(0,1,2,3,4,); $test2 = array_filter($test, function($value) { global $test; unset($test[$value]); return $value; }); print_r($test); print_r($test2); And here was the result: Array ( ) Array ( [1] => 1 [2] => 2 [3] => 3 [4] => 4 ) ---- Server IP: 72.52.91.14 Probable Submitter: 71.237.216.101 ---- Manual Page -- http://php.net/manual/en/function.array-filter.php Edit -- https://master.php.net/note/edit/116929 Del: integrated -- https://master.php.net/note/delete/116929/integrated Del: useless -- https://master.php.net/note/delete/116929/useless Del: bad code -- https://master.php.net/note/delete/116929/bad+code Del: spam -- https://master.php.net/note/delete/116929/spam Del: non-english -- https://master.php.net/note/delete/116929/non-english Del: in docs -- https://master.php.net/note/delete/116929/in+docs Del: other reasons-- https://master.php.net/note/delete/116929 Reject -- https://master.php.net/note/reject/116929 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202011) next »