3v4l.org

run code in 300+ PHP versions simultaneously
<?php $all = [ '1', '2', '3', '4', ]; $new = [ '3', '2', '5', ]; $toRemove = array_diff($all, $new); $toAdd = array_intersect($all, $new); print_r($toAdd); print_r($toRemove);

preferences:
37.28 ms | 402 KiB | 5 Q