3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <form method="get" action=""> Enter the First Number <input type="text" name="number1"> Enter the Second Number <input type="text" name="number2"> Choose the operation <input type="radio" name="op" value="add" checked> Addition <input type="radio" name="op" value="sub"> Subtraction <input type="radio" name="op" value="mul"> Multiplication <input type="radio" name="op" value="div"> Division <input type="submit" name="Submit" value="Submit"> </form> <?php if ( $op == "add" ) { echo "$number1 + $number2 = "; echo $number1 + $number2; } if ( $op == "sub" ) { echo "$number1 - $number2 = "; echo $number1 - $number2; } if ( $op == "mul" ) { echo "$number1 * $number2 = "; echo $number1 * $number2; } if ( $op == "div" ) { echo "$number1 / $number2 = "; echo $number1 / $number2; } ?> </body> </html>
Output for 5.0.4 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <form method="get" action=""> Enter the First Number <input type="text" name="number1"> Enter the Second Number <input type="text" name="number2"> Choose the operation <input type="radio" name="op" value="add" checked> Addition <input type="radio" name="op" value="sub"> Subtraction <input type="radio" name="op" value="mul"> Multiplication <input type="radio" name="op" value="div"> Division <input type="submit" name="Submit" value="Submit"> </form> Notice: Undefined variable: op in /in/nQNIn on line 27 Notice: Undefined variable: op in /in/nQNIn on line 32 Notice: Undefined variable: op in /in/nQNIn on line 37 Notice: Undefined variable: op in /in/nQNIn on line 42 </body> </html>
Output for 4.3.0 - 5.0.3
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <form method="get" action=""> Enter the First Number <input type="text" name="number1"> Enter the Second Number <input type="text" name="number2"> Choose the operation <input type="radio" name="op" value="add" checked> Addition <input type="radio" name="op" value="sub"> Subtraction <input type="radio" name="op" value="mul"> Multiplication <input type="radio" name="op" value="div"> Division <input type="submit" name="Submit" value="Submit"> </form> Notice: Undefined variable: op in /in/nQNIn on line 27 Notice: Undefined variable: op in /in/nQNIn on line 32 Notice: Undefined variable: op in /in/nQNIn on line 37 Notice: Undefined variable: op in /in/nQNIn on line 42 </body> </html>