3v4l.org

run code in 200+ 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> echo "Please enter value 1 : "; fscanf(STDIN, "%d\n", $value1); // reads number from STDIN standard input echo "Please enter value 2 : "; fscanf(STDIN, "%d\n", $value2); echo "Answer : " .($value1 + $value2) . "\n";
based on r0AfA
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/WWWUY
function name:  (null)
number of ops:  5
compiled vars:  !0 = $value1, !1 = $value2
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  13     0  E >   ECHO                                                     '%3Fphp%0A+++++++%24value1+%3D+%24_POST%5B%27value1%27%5D%3B%0A+++++++%24value2+%3D+%24_POST%5B%27value2%27%5D%3B%0A%3F%3E%0A%3Chtml%3E%0A+++++++%3Ctitle%3EPHP+-+Add+two+numbers%3C%2Ftitle%3E%0A+++++++%3Cbody%3E%0A++++++++++++++%3Cform+action%3D%22addtwonumbers.php%22+method%3D%22post%22%3E%0A+++++++++++++++++++++%3Cinput+type%3D%22text%22+name%3D%22value1%22+value%3D%220%22+%2F%3E%0A+++++++++++++++++++++%3Cinput+type%3D%22text%22+name%3D%22value2%22+value%3D%220%22+%2F%3E%0A+++++++++++++++++++++%3Cinput+type%3D%22submit%22+value%3D%22Calculate+values%22%2F%3E%0A++++++++++++++%3C%2Fform%3E%0A++++++++++++++Answer+%3A+'
         1        ADD                                              ~2      !0, !1
         2        ECHO                                                     ~2
  21     3        ECHO                                                     '+++++++%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A%0A+echo+%22Please+enter+value+1+%3A+%22%3B%0A+fscanf%28STDIN%2C+%22%25d%5Cn%22%2C+%24value1%29%3B+%2F%2F+reads+number+from+STDIN+standard+input%0A+echo+%22Please+enter+value+2+%3A+%22%3B%0A+fscanf%28STDIN%2C+%22%25d%5Cn%22%2C+%24value2%29%3B%0A+echo+%22Answer+%3A+%22+.%28%24value1+%2B+%24value2%29+.+%22%5Cn%22%3B'
         4      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.1.0