Php Array Diff. To get the difference between the two arrays you need to do the following. Php array diff function definition and usage.
Parameters of array diff function. Php array diff function definition and usage. Array c 3 print r array diff assoc b a.
The reason being that array diff will only give you the values that are in array1 but not array2 not the other way around.
To put it another way array udiff compares a 0 to b 0 b 1 b 2 and b 3 using the provided callback function. Subtraction of elements in array a that are in array b and not what elements are different between the arrays i e. Array c 3 print r array diff assoc b a. For example objects may be different if they have different id.