note 13953 deleted from function.array-diff by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 20:59:25 +0000 |
| Subject: | note 13953 deleted from function.array-diff by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25451@lists.php.net to get a copy of this message | ||
array_diff() seems to sort the array in ascending order (without actually changing the keys), which
can be a very annoying side effect sometimes, especially when you have the array in some special
order (e.g. based on some criteria from the db).
--
$a=array(4,5,6,2,1);
$b=array(6);
$c=array_diff($a,$b);
print_r($c);
--
produces:
Array
(
[4] => 1
[3] => 2
[0] => 4
[1] => 5
)
--
Does anyone have an elegant solution to this?