3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
01 <html> 02 <head> 03 <title> Grade Book</title> 04 </head> 05 <body> 06 07 <?php 08 $fname=$_REQUEST["fname"]; 09 $lname=$_REQUEST["lname"]; 10 $test1=$_REQUEST["test1"]; 11 $test2=$_REQUEST["test2"]; 12 $test3=$_REQUEST["test3"]; 13 14 15 //test information 16 $avg = average($test1, $test2, $test3); 17 $lg = lettergrade($avg); 18 fname(); 19 lname(); 20 $test1 = test1($avg); 21 $test2 = test2($avg); 22 $test3 = test3($avg); 23 avg(); 24 25 26 function fname() 27 {print "First Name:"; 28 print $fname; 29 print "<br>"; 30 print "<br>"; 31 } 32 33 function lname() 34 {print "Last Name:"; 35 print "<br>"; 36 print "<br>"; 37 } 38 39 function test1() 40 {print "Test 1"; 41 print "<br>"; 42 print "<br>"; 43 } 44 45 function test2() 46 {print "Test 2"; 47 print "<br>"; 48 print "<br>"; 49 } 50 51 function test3() 52 {print "Test 3"; 53 print "<br>"; 54 print "<br>"; 55 } 56 57 function avg() 58 {print "Average Grade"; 59 print "<br>"; 60 print "<br>"; 61 } 62 63 function average($test1,$test2,$test3) 64 { 65 $avg = ($test1 + $test2 + $test3) / 3; 66 return $avg; 67 } 68 69 function lettergrade($avg) 70 { 71 if ($avg >= 90) 72 $lettergrade = "A"; 73 74 if ($avg >= 80 && $avg <= 89) 75 $lettergrade = "B"; 76 77 if ($avg >= 70 && $avg <= 79) 78 $lettergrade = "C"; 79 80 if ($avg >= 60 && $avg <= 69) 81 $lettergrade = "D"; 82 83 if ($avg >= 50 && $avg <= 59) 84 $lettergrade = "F"; 85 86 87 return $lettergrade; 88 } 89 90 91 92 93 94 95 ?> 96 97 </body> 98 </html
based on LNWto
Output for 5.4.0 - 5.4.32
Parse error: syntax error, unexpected '$fname' (T_VARIABLE) in /in/5JlYO on line 16
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/5JlYO on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_VARIABLE in /in/5JlYO on line 16
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/5JlYO on line 16
Process exited with code 255.