fork(2) download
  1. <?php
  2.  
  3. $a = [1,2,3,4,5];
  4. $b = [2,4,6,7];
  5.  
  6. $common = array_intersect( $b, $a );
  7.  
  8. $diff1 = array_diff( $a, $common );
  9. $diff2 = array_diff( $b, $common );
  10.  
  11. print_r( $diff1 );
  12. print_r( $diff2 );
  13.  
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 1
    [2] => 3
    [4] => 5
)
Array
(
    [2] => 6
    [3] => 7
)