Here are the arrays.
Array1
(
[439] => dsaffsdfdfdfsffdsf
[379] => 3454
[375] => 3 ///why is it removed in the resulting array?
[436] => Fdsafdfsdf
[432] => 3 /// this one too
[431] => 2
[385] => 499
[434] => 3501
[435] => 2013-01-16
[430] => 1
[440] => fsdzsdaffdsfffdsf
[406] => YES
[438] => 32442344324324234
[376] => 3
)
Array2
(
[376] => 3
[385] => 499
)
array_diff(array1, array2)
result
(
[439] => dsaffsdfdfdfsffdsf
[379] => 3454
[436] => Fdsafdfsdf
[431] => 2
[434] => 3501
[435] => 2013-01-16
[430] => 1
[440] => fsdzsdaffdsfffdsf
[406] => YES
[438] => 32442344324324234
)
Looks weird to me. Any idea? Its removing based on value?
I just want Array2
elements removed from Array1
array_diff
- Returns an array containing all the entries from array1 that are not present in any of the other arrays. – Peter Jan 16 '13 at 23:42array_diff_assoc
. – Jon Jan 16 '13 at 23:44