On 30 avr. 04, at 11:00, Torsten Roehr wrote:


I 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().

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()."

Fred

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

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to