3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = [1, 4, 0, 8, 2, 0, 3, 0]; $x = 0; $newItems = array_diff($items, [$x]); var_dump($newItems);
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.28, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
array(5) { [0]=> int(1) [1]=> int(4) [3]=> int(8) [4]=> int(2) [6]=> int(3) }