|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-03-25 15:51 UTC] laruence@php.net
[2015-03-25 15:51 UTC] laruence@php.net
-Status: Open
+Status: Closed
[2016-07-20 11:39 UTC] davey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
Description: ------------ PHP 5.6.0 added a third argument to array_filter, $flag, which can accept one of the integer constants ARRAY_FILTER_USE_KEY or ARRAY_FILTER_USE_BOTH. When the former is specified, the key is passed as the sole argument to the callback; when the latter is specified, the value and the key, in that order, are passed to the callback. Under the current master branch, the $flag is ignored. Test script: --------------- $toFilter = array('foo' => 'bar', 'fiz' => 'buz'); $filtered = array_filter($toFilter, function ($value, $key) { if ($value === 'buz' || $key === 'foo' ) { return false; } return true; }, ARRAY_FILTER_USER_BOTH); var_export($filtered); Expected result: ---------------- array() Actual result: -------------- Missing argument 2 for {closure}()