3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $existing = array(1,2,3,4); $onForm = array(3,4,5,6); $removed = array_diff($existing,$onForm); $new = array_diff($onForm,$existing); echo 'existing'; print_r($existing); echo 'form'; print_r($onForm); echo 'removed'; print_r($removed); echo 'new'; print_r($new);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
existingArray ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) formArray ( [0] => 3 [1] => 4 [2] => 5 [3] => 6 ) removedArray ( [0] => 1 [1] => 2 ) newArray ( [2] => 5 [3] => 6 )