3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php define('PHYSICS_SEMESTER_GRADE', 2.8); define('MATHS_SEMESTER_GRADE', 3.5); $grades = array(1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6); $physics = $maths = []; foreach ($grades as $grade) { $physics[$grade] = round(round((PHYSICS_SEMESTER_GRADE + $grade) / 2, 2), 1); $maths[$grade] = round(round((MATHS_SEMESTER_GRADE + $grade) / 2, 2), 1); } var_dump($physics, $maths);