fork(1) download
  1. <?php
  2.  
  3. $currentValues = [1, 2];
  4. $newValues = [1, 3, 1, 4, 2];
  5. print_r(array_merge($currentValues, array_diff($newValues, $currentValues)));
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
)