note 49229 added to function.array-udiff
| From: | dmhouse at gmail dot com | Date: | Thu, 20 Jan 2005 21:44:04 +0000 |
| Subject: | note 49229 added to function.array-udiff | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83698@lists.php.net to get a copy of this message | ||
Very easy way of achieving a case-insensitive version of array_diff (or indeed array_diff_assoc,
array_intersect or any of these types of functions which have a similar function that takes a
callback function as one of their parameters):
array_udiff($array1, $array2, 'strcasecmp');
This works because strcasecmp() compares two strings case-insensitively, as compared to the
array_diff() which compares two strings by using the == operator, which is case-sensitive.
----
Manual Page -- http://www.php.net/manual/en/function.array-udiff.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49229
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49229&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49229&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49229&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49229&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49229&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49229&report=yes
Search -- http://master.php.net/manage/user-notes.php