I have two arrays both are two dimensional. I am comparing spreadsheet rows with DB rows. array key for both arrays are same.
array from DB fetch
$array1 = Array
(
[0] => Array
(
[uid] => 1
[fname] => abc
[lname] => deg
[phone] => 123456789
)
[1] => Array
(
[uid] => 2
[fname] => jkl
[lname] => xyz
[phone] => 987654321
)
[2] => Array
(
[uid] => 3
[fname] => pqr
[lname] => stu
[phone] => 111111111
)
array created from spreadsheet
$array2 = Array
(
[0] => Array
(
[uid] => 1
[fname] => abc
[lname] => deg
[phone] => 4444444
)
[1] => Array
(
[uid] => 3
[fname] => pqr
[lname] => stu
[phone] => 111111111
)
[2] => Array
(
[uid] => 4
[fname] => aaa
[lname] => bbb
[phone] => 9999999
)
Now I want only those key and value for specific user which are different.
For example : for uid=1, only phone should display. for uid=2, entire array should display. for uid=3, none(blank array) should display.
I have used array_diff() and it worked fine. but problem is that my code compare consequently (ir-respetive of uid). I want uid of array1 to be compare with uid of array2.