Compare two array and get all differences
arraylist, arrays, multidimensional-array, php
Solution
try this
array_merge(array_diff($array1,$array2),array_diff($array2,$array1))
Problem
I have two arrays like this. ``` $array1=array(1,2,3,4,5,7); $array2=array(1,2,3,4,5,6); ``` So, the output should bring the difference in both arrays. The output should be. 1,2,3,4,5 -> These numbers exist in both arrays, so these should be ignored. 7 and 6 -> These numbers are the un-common in both arrays, so I need these values in array. The output should be 7 & 6. Help me out. I have tried `array_diff` and other array elements.