[ create a new paste ] login | about

Link: http://codepad.org/JianpnYh    [ raw code | output | fork ]

PHP, pasted on Nov 2:
<?php

$array1 = array(
    0 => 5,
    1 => 25,
    2 => 3,
    3 => 9,
    4 => 15,
    5 => 8,
    6 => 26,
    7 => 1
);

$array2 = array(
    0 => 5,
    1 => 25,
    2 => 3,
    3 => 9,
    4 => 6,
    5 => 26,
    6 => 1,
    7 => 53,
    8 => 22
);

$deleted = array_diff( $array1, $array2);
var_dump( $deleted);

$insert = array_diff( $array2, $array1);
var_dump( $insert);

$same = array_intersect( $array1, $array2);
var_dump( $same);


Output:
array(2) {
  [4]=>
  int(15)
  [5]=>
  int(8)
}
array(3) {
  [4]=>
  int(6)
  [7]=>
  int(53)
  [8]=>
  int(22)
}
array(6) {
  [0]=>
  int(5)
  [1]=>
  int(25)
  [2]=>
  int(3)
  [3]=>
  int(9)
  [6]=>
  int(26)
  [7]=>
  int(1)
}


Create a new paste based on this one


Comments: