Edit report at https://bugs.php.net/bug.php?id=60485&edit=1
ID: 60485
Comment by: phristen at yahoo dot com
Reported by: Hast4656 at gmail dot com
Summary: in_array insensitive string comparison
Status: Open
Type: Feature/Change Request
Package: Arrays related
Operating System: linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
How about adding a comparitor callback then?
Maybe even overload the third argument (e.g. if it's not a boolean, then assume
callback), so we can do something like:
in_array('a', array('A', 'b'), function($a, $b) { return !strcasecmp($a, $b);
});
Previous Comments:
------------------------------------------------------------------------
[2011-12-14 18:01:34] [email protected]
Since in_array() handles different types, I don't think it would make sense to
add a parameter that is exclusive to handling strings.
------------------------------------------------------------------------
[2011-12-09 16:48:11] Hast4656 at gmail dot com
Description:
------------
Can you please add parameter for in_array that let this function to compare
strings insensitive?
Test script:
---------------
// something like
in_array('a', Array('a', 'A'), true, true);
// 4th bool param says should the function compare string in a case-sensitive
manner or not
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60485&edit=1