3v4l.org

run code in 300+ PHP versions simultaneously
<?php CONST MIN = 1; CONST MAX = 1000000000; $result = 0; for ($i = MIN; $i <= MAX; $i++) { $result += $i; } var_dump($result); $result = (MIN + MAX) * (MAX / 2); //It's *MAX/2 because the step is 1 (there are MAX elements to the series). var_dump($result);

preferences:
37.94 ms | 402 KiB | 5 Q