note 31775 deleted from function.array-diff by didou
| From: | didou@php.net | Date: | Sun, 18 May 2003 01:42:08 +0000 |
| Subject: | note 31775 deleted from function.array-diff by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48325@lists.php.net to get a copy of this message | ||
Note Submitter:
----
> Order appears to matter with array_diff...
> $dif = array_diff ($HTTP_POST_VARS[user], $my_list); // Gave expected results
> $dif = array_diff ($my_list, $HTTP_POST_VARS[user]); // No Results
That's right, because array_diff() takes the first given array, then removes from it any values
that are present in any of the other arrays. So your first example would remove any values in
$my_list from $_POST['vars'], whereas the second example will remove any values in
$_POST['vars'] from $my_list.