3v4l.org

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

preferences:
30.23 ms | 402 KiB | 5 Q