3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<!DOCTYPE html> <html> <head> <title> Average</title> </head> <body> <?php $fname=$_GET["fname"]; $lname=$_GET["lname"]; $test1=$_GET["sub1"]; $test2=$_GET["sub2"]; $test3=$_GET["sub3"]; //subject information $avg = average($sub1, $sub2, $sub3); $lg = lettergrade($avg); fname(); lname(); $sub1 = sub1($avg); $sub2 = sub2($avg); $sub3 = sub3($avg); avg(); function fname() {print "First Name:"; print $fname; print "<br>"; print "<br>"; } function lname() {print "Last Name:"; print "<br>"; print "<br>"; } function sub1() {print "sub 1"; print "<br>"; print "<br>"; } function sub2() {print "sub 2"; print "<br>"; print "<br>"; } function sub3() {print "sub 3"; print "<br>"; print "<br>"; } function avg() {print "Average Grade"; print "<br>"; print "<br>"; } function average($sub1,$sub2,$sub3) { $avg = ($sub1 + $sub2 + $sub3)/3; return $avg; } function lettergrade($avg) { if ($avg >= 80 && $avg<=100) $lettergrade = "A"; if ($avg >=65 && $avg <= 79) $lettergrade = "B"; if ($avg >= 50 && $avg <= 64) $lettergrade = "C"; if ($avg >= 40 && $avg <= 49) $lettergrade = "D"; if ($avg >= 0 && $avg <= 39) $lettergrade = "E"; return $lettergrade; }
based on vFj3A
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<!DOCTYPE html> <html> <head> <title> Average</title> </head> <body> Notice: Undefined index: fname in /in/HcBRW on line 8 Notice: Undefined index: lname in /in/HcBRW on line 9 Notice: Undefined index: sub1 in /in/HcBRW on line 10 Notice: Undefined index: sub2 in /in/HcBRW on line 11 Notice: Undefined index: sub3 in /in/HcBRW on line 12 Notice: Undefined variable: sub1 in /in/HcBRW on line 15 Notice: Undefined variable: sub2 in /in/HcBRW on line 15 Notice: Undefined variable: sub3 in /in/HcBRW on line 15 First Name: Notice: Undefined variable: fname in /in/HcBRW on line 26 <br><br>Last Name:<br><br>sub 1<br><br>sub 2<br><br>sub 3<br><br>Average Grade<br><br>
Output for 5.0.4 - 5.2.17
<!DOCTYPE html> <html> <head> <title> Average</title> </head> <body> Notice: Undefined index: fname in /in/HcBRW on line 8 Notice: Undefined index: lname in /in/HcBRW on line 9 Notice: Undefined index: sub1 in /in/HcBRW on line 10 Notice: Undefined index: sub2 in /in/HcBRW on line 11 Notice: Undefined index: sub3 in /in/HcBRW on line 12 Notice: Undefined variable: sub1 in /in/HcBRW on line 15 Notice: Undefined variable: sub2 in /in/HcBRW on line 15 Notice: Undefined variable: sub3 in /in/HcBRW on line 15 First Name: Notice: Undefined variable: fname in /in/HcBRW on line 26 <br><br>Last Name:<br><br>sub 1<br><br>sub 2<br><br>sub 3<br><br>Average Grade<br><br>
Output for 4.3.0 - 5.0.3
<!DOCTYPE html> <html> <head> <title> Average</title> </head> <body> Notice: Undefined index: fname in /in/HcBRW on line 8 Notice: Undefined index: lname in /in/HcBRW on line 9 Notice: Undefined index: sub1 in /in/HcBRW on line 10 Notice: Undefined index: sub2 in /in/HcBRW on line 11 Notice: Undefined index: sub3 in /in/HcBRW on line 12 Notice: Undefined variable: sub1 in /in/HcBRW on line 15 Notice: Undefined variable: sub2 in /in/HcBRW on line 15 Notice: Undefined variable: sub3 in /in/HcBRW on line 15 First Name: Notice: Undefined variable: fname in /in/HcBRW on line 26 <br><br>Last Name:<br><br>sub 1<br><br>sub 2<br><br>sub 3<br><br>Average Grade<br><br>