3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<!doctype html> <html> <head> <title>question2</title> <head> <body> if(isset($_POST['num1'])){ $num1 = $_POST['num1']; $num2 = $_POST['num2']; $result = $num1 + $num2; } ?> <form action="test.htm" method="post" name="myform" align="center"> Enter number 1:<input type="text" name="num1" /> <br> Enter number 2:<input type="text" name="num2" /> <br> <input type="submit" name="result" /> </form> <hr> <table border='1' align='center'> <td>number 1</td><td>calculate</td><td>number 2</td><td>result</td> <tr> <td> <? echo $num1; ?> </td> <td>+</td> <td> <? echo $num2; ?> </td> <td> <? echo $result; ?> </td> //</table> </body> </html>
based on YXHTP
Output for 5.4.34 - 7.1.0
<!doctype html> <html> <head> <title>question2</title> <head> <body> if(isset($_POST['num1'])){ $num1 = $_POST['num1']; $num2 = $_POST['num2']; $result = $num1 + $num2; } ?> <form action="test.htm" method="post" name="myform" align="center"> Enter number 1:<input type="text" name="num1" /> <br> Enter number 2:<input type="text" name="num2" /> <br> <input type="submit" name="result" /> </form> <hr> <table border='1' align='center'> <td>number 1</td><td>calculate</td><td>number 2</td><td>result</td> <tr> <td> Notice: Undefined variable: num1 in /in/rKgV8 on line 28 </td> <td>+</td> <td> Notice: Undefined variable: num2 in /in/rKgV8 on line 32 </td> <td> Notice: Undefined variable: result in /in/rKgV8 on line 35 </td> //</table> </body> </html>
Output for 4.3.0 - 5.4.32
<!doctype html> <html> <head> <title>question2</title> <head> <body> if(isset($_POST['num1'])){ $num1 = $_POST['num1']; $num2 = $_POST['num2']; $result = $num1 + $num2; } ?> <form action="test.htm" method="post" name="myform" align="center"> Enter number 1:<input type="text" name="num1" /> <br> Enter number 2:<input type="text" name="num2" /> <br> <input type="submit" name="result" /> </form> <hr> <table border='1' align='center'> <td>number 1</td><td>calculate</td><td>number 2</td><td>result</td> <tr> <td> <? echo $num1; ?> </td> <td>+</td> <td> <? echo $num2; ?> </td> <td> <? echo $result; ?> </td> //</table> </body> </html>