3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
Calculator <form action = "calculator.php" method = "post"> <table> <table width="300" height="200" border="20"> <tr><td>first number: </tr><td><input type="text" name="num1"><br></td><tr> <tr><td>0perattor: </tr><td><input type="text" name="oper"><br></td><tr> <tr><td>second number: </tr><td><input type="text" name="num2"><br></td><tr> </tr><td></tr><td><input type="submit" value="solve"></td><tr> </table> </form> <?php $num1=$_POST['num1']; $num2=$_POST['num2']; $oper=$_POST['oper']; if($oper=='+'){ $result= $num1+$num2 ; echo "The Sum is $result"; }else if($oper=='-'){ $result= $num1-$num2; echo "The Difference is $result"; }else if($oper=='*'){ $result= $num1*$num2 ; echo "The Product is $result"; }else if($oper=='/'){ $result= $num1/$num2 ; echo "The Quotient is $result"; }else echo" Operator doest not exist" ?>
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Calculator <form action = "calculator.php" method = "post"> <table> <table width="300" height="200" border="20"> <tr><td>first number: </tr><td><input type="text" name="num1"><br></td><tr> <tr><td>0perattor: </tr><td><input type="text" name="oper"><br></td><tr> <tr><td>second number: </tr><td><input type="text" name="num2"><br></td><tr> </tr><td></tr><td><input type="submit" value="solve"></td><tr> </table> </form> Notice: Undefined index: num1 in /in/kioMj on line 17 Notice: Undefined index: num2 in /in/kioMj on line 18 Notice: Undefined index: oper in /in/kioMj on line 19 Operator doest not exist
Output for 4.3.0 - 5.2.17
Calculator <form action = "calculator.php" method = "post"> <table> <table width="300" height="200" border="20"> <tr><td>first number: </tr><td><input type="text" name="num1"><br></td><tr> <tr><td>0perattor: </tr><td><input type="text" name="oper"><br></td><tr> <tr><td>second number: </tr><td><input type="text" name="num2"><br></td><tr> </tr><td></tr><td><input type="submit" value="solve"></td><tr> </table> </form> Notice: Undefined index: num1 in /in/kioMj on line 17 Notice: Undefined index: num2 in /in/kioMj on line 18 Notice: Undefined index: oper in /in/kioMj on line 19 Operator doest not exist