How to determine the different data of two arrays in the php array problem, and the output is as follows: assume there are two arrays $ a = array ); and $ B = array (, 9); ask how to explain the two arrays of different data output I use the for loop only outputs the same but the output is different, ask how to implement, two arrays have different data outputs, that is, how to determine the different data of the two arrays and output the non-intersection php array problem
Assume that there are two arrays.
$ A = array );
And
$ B = array (1, 3, 5, 7, 9 );
How can I explain the different data outputs of two arrays?
I use the for loop to output the same
But if the output is different, ask how to implement it.
------ Solution --------------------
Two arrays have different data outputs, that is, non-intersection?
PHP code
$ A = array (, 9, 0); $ B = array (, 9); $ out1 = array_diff ($ a, $ B ); $ out2 = array_diff ($ B, $ a); $ out3 = array_merge ($ out1, $ out2); foreach ($ out3 as $ rs3) {echo $ rs3 .''; // 2 4 6 8 0}