Re: Re: unexpected array_diff output
| From: | Frederic Noyer | Date: | Fri, 30 Apr 2004 09:24:50 +0000 |
| Subject: | Re: Re: unexpected array_diff output | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185027@lists.php.net to get a copy of this message | ||
On 30 avr. 04, at 11:00, Torsten Roehr wrote:
As I have understand only the array_diff_assoc function does that. see php.net: "Description array array_diff_assoc ( array array1, array array2 [, array ...]) array_diff_assoc() returns an array containing all the values from array1 that are not present in any of the other arguments. Note that the keys are used in the comparison unlike array_diff()." FredI think this is correct because the 3 key/value pairs from the first array are NOT in the second one. I think the combination of key and value are relevant for array_diff().
So if you had: Array from POST: Array ( [0] => 2 [1] => 3 [2] => 4 ) Array from SQL : Array ( [0] => 2 [1] => 3 ) ****** The diff would be: array_diff results : Array ( [2] => 4 ) Regards, Torsten