note 128810 added to function.array-keys
| From: | vittorh at outlook dot com | Date: | Thu, 17 Aug 2023 20:44:35 +0000 |
| Subject: | note 128810 added to function.array-keys | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220771@lists.php.net to get a copy of this message | ||
Hello friends
Guys in the array_keys function manual - https://www.php.net/manual/pt_BR/function.array-keys.php
it is described that in the second search parameter " $filter_value " is defined in mixed
type, however in php 7.4 to version 8.1 when passing a $filter_value of type array, the function
without returning false ( empty array )
Exemple :
$array = ['a' => 1, 'b' => 2];
var_dump(array_keys($array,array('a','b'))); // return array(0) { }
var_dump(array_keys($array,array('a','b'))); // return array(0) { }
var_dump(array_keys($array,'a')); // return array(0) { }
Debugging the code, I believe that the description of the $filter_value parameter is confusing, as
it is understood that the value of the key in the array has to be the specified value and not the
content of the key
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 177.21.82.142)
----
Manual Page -- https://php.net/manual/en/function.array-keys.php
Edit -- https://main.php.net/note/edit/128810
Del: integrated -- https://main.php.net/note/delete/128810/integrated
Del: useless -- https://main.php.net/note/delete/128810/useless
Del: bad code -- https://main.php.net/note/delete/128810/bad+code
Del: spam -- https://main.php.net/note/delete/128810/spam
Del: non-english -- https://main.php.net/note/delete/128810/non-english
Del: in docs -- https://main.php.net/note/delete/128810/in+docs
Del: other reasons-- https://main.php.net/note/delete/128810
Reject -- https://main.php.net/note/reject/128810
Search -- https://main.php.net/manage/user-notes.php