3v4l.org

run code in 300+ PHP versions simultaneously
<?php $horas_totais = 27; $horario_dos_km = 9.3; $getallours = []; $rasteach = round($horas_totais / $horario_dos_km, 1, PHP_ROUND_HALF_UP); $tot = 0; for ($z = 0; $z < $horario_dos_km - 1; $z++) { $tot += $rasteach; $getallours[] = $tot; } $getallours[] = $horas_totais; print_r($getallours);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Array ( [0] => 2.9 [1] => 5.8 [2] => 8.7 [3] => 11.6 [4] => 14.5 [5] => 17.4 [6] => 20.3 [7] => 23.2 [8] => 26.1 [9] => 27 )

preferences:
167.55 ms | 408 KiB | 5 Q