3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = 100; $end = 200; $step = 10; echo array_sum(range($start, $end, $step)); echo "\n---\n"; $factors = [2, 5]; $total = 0; for ($i = $start; $i <= $end; ++$i) { foreach ($factors as $f) { if ($i % $f !== 0) { continue 2; } } $total += $i; } echo $total;
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
1650 --- 1650

preferences:
99.6 ms | 402 KiB | 62 Q