<?php $currentValues = [1, 2];$newValues = [1, 3, 1, 4, 2];print_r(array_merge($currentValues, array_diff($newValues, $currentValues)));
Standard input is empty
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!