It seems that every PHP function I read about for comparing arrays (array_diff()
, array_intersect()
, etc) compares for the existence of array elements.
Given two multidimensional arrays with identical structure, how would you list the differences in values?
Example
Array 1
[User1] => Array ([public] => 1 [private] => 1 [secret] => 1 ) [User2] => Array ([public] => 1 [private] => 0 [secret] => 0 )
Array 2
[User1] => Array ([public] => 1 [private] => 0 [secret] => 1 ) [User2] => Array ([public] => 1 [private] => 0 [secret] => 0 )
Difference
[User1] => Array ([public] => 1 [private] => 0 //this value is different [secret] => 1 )
So my result would be - "Of all the users, User1 has changed, and the difference is that private is 0 instead of 1."