3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html> <head><title>Calculator</title></head> <body> <form action="calculator.php" method="POST"> <p> <label for="firstnumber">First Number</label> <input type="text" name="firstnumber" id="firstnumber" /> </p> <p> <label for="second number">Second Number:</label> <input type="text" name="secondnumber" id="secondnumber" /> </p> <p> <input type="radio" name="Operation" value="Add" id="addinput" /> <label for="addinput">Add</label> <input type="radio" name="Operation" value="Sub" id="subinput" /> <label for="subinput">Sub</label> <input type="radio" name="Operation" value="Mult" id="multinput" /> <label for="multinput">Mult</label> <input type="radio" name="Operation" value="Div" id="divinput" /> <label for="divinput">Div</label> </p> <p> <input type="submit" value="=" /> <input type="reset" /> </p> </form> <?php $Operation = $_POST['Operation']; $x = $_POST["firstnumber"]; $y = $_POST["secondnumber"]; if($Operation == "Add"){ echo ($x + $y); } if($Operation == "Sub"){ echo ($x - $y); } if($Operation == "Mult"){ echo ($x * $y); } if($Operation == "Div"){ if ($y==0){ echo "error-cannot divide by zero"; } else echo = ($x / $y); } ?> </body> </html>
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.32
Parse error: syntax error, unexpected '=' in /in/Jf7vJ on line 51
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '=' in /in/Jf7vJ on line 51
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '=', expecting ',' or ';' in /in/Jf7vJ on line 51
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected '=', expecting ',' or ';' in /in/Jf7vJ on line 51
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `','' or `';'' in /in/Jf7vJ on line 51
Process exited with code 255.

preferences:
209.81 ms | 1395 KiB | 123 Q