3v4l.org

run code in 500+ PHP versions simultaneously
<?php $count = [1,1,1,0,0,0,0,1,1,0,0]; $numOfCounts = count($count); for ($i = 0; $i < $numOfCounts; $i++) { if (0 == (int) $count[$i]) unset($count[$i]); } var_dump($count);

preferences:
42.09 ms | 1393 KiB | 5 Q