3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
?php $value1 = $_POST['value1']; $value2 = $_POST['value2']; ?> <html> <title>PHP - Add two numbers</title> <body> <form action="addtwonumbers.php" method="post"> <input type="text" name="value1" value="0" /> <input type="text" name="value2" value="0" /> <input type="submit" value="Calculate values"/> </form> Answer : <?php echo ($value1 + $value2); ?> </body> </html>
based on K0T0N
Output for 5.0.4 - 5.0.5, 7.0.0 - 7.1.0
?php $value1 = $_POST['value1']; $value2 = $_POST['value2']; ?> <html> <title>PHP - Add two numbers</title> <body> <form action="addtwonumbers.php" method="post"> <input type="text" name="value1" value="0" /> <input type="text" name="value2" value="0" /> <input type="submit" value="Calculate values"/> </form> Answer : Notice: Undefined variable: value1 in /in/lJObA on line 13 Notice: Undefined variable: value2 in /in/lJObA on line 13 0 </body> </html>
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0
?php $value1 = $_POST['value1']; $value2 = $_POST['value2']; ?> <html> <title>PHP - Add two numbers</title> <body> <form action="addtwonumbers.php" method="post"> <input type="text" name="value1" value="0" /> <input type="text" name="value2" value="0" /> <input type="submit" value="Calculate values"/> </form> Answer : Notice: Undefined variable: value2 in /in/lJObA on line 13 Notice: Undefined variable: value1 in /in/lJObA on line 13 0 </body> </html>
Output for 4.3.0 - 5.0.3
?php $value1 = $_POST['value1']; $value2 = $_POST['value2']; ?> <html> <title>PHP - Add two numbers</title> <body> <form action="addtwonumbers.php" method="post"> <input type="text" name="value1" value="0" /> <input type="text" name="value2" value="0" /> <input type="submit" value="Calculate values"/> </form> Answer : Notice: Undefined variable: value1 in /in/lJObA on line 13 Notice: Undefined variable: value2 in /in/lJObA on line 13 0 </body> </html>