3v4l.org

run code in 300+ PHP versions simultaneously
<?php function add($x,$y){ $add=$x + $y; return $add; } function subtract($x,$y){ $subtract=$x - $y; return $subtract; } function multiply($x,$y){ $multiply=$x * $y; return $multiply; } function divide($x,$y){ $divide=$x / $y; return $divide; } if(isset($_POST['submit'])){ $x=$_POST['num1']; $y=$_POST['num2']; $z=$_POST['express']; if($z == 'add'){ $result=add($x,$y); } else if($z=='subtract'){ $result=subtract($x,$y); } else if($z=='multiply'){ $result=multiply($x,$y); } else{ $result=divide($x,$y); } } ?> <html> <body> <form action="#" method="post"> Num1:<input name="num1"><br> <input type='radio' name='express' value='add'>+ <input type='radio' name='express' value='subtract'>- <input type='radio' name='express' value='multiply'>* <input type='radio' name='express' value='divide'>/ <br> Num2:<input name="num2"> Result<input value='<?php if(isset($result)){echo $result;} ?>'> <input type="submit" name="submit"> </form> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 41
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 45
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 28
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 36
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 45
Branch analysis from position: 44
Branch analysis from position: 45
Branch analysis from position: 41
filename:       /in/usbrc
function name:  (null)
number of ops:  47
compiled vars:  !0 = $x, !1 = $y, !2 = $z, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   FETCH_IS                                         ~4      '_POST'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~4, 'submit'
          2      > JMPZ                                                     ~5, ->41
   30     3    >   FETCH_R                      global              ~6      '_POST'
          4        FETCH_DIM_R                                      ~7      ~6, 'num1'
          5        ASSIGN                                                   !0, ~7
   31     6        FETCH_R                      global              ~9      '_POST'
          7        FETCH_DIM_R                                      ~10     ~9, 'num2'
          8        ASSIGN                                                   !1, ~10
   32     9        FETCH_R                      global              ~12     '_POST'
         10        FETCH_DIM_R                                      ~13     ~12, 'express'
         11        ASSIGN                                                   !2, ~13
   33    12        IS_EQUAL                                                 !2, 'add'
         13      > JMPZ                                                     ~15, ->20
   34    14    >   INIT_FCALL                                               'add'
         15        SEND_VAR                                                 !0
         16        SEND_VAR                                                 !1
         17        DO_FCALL                                      0  $16     
         18        ASSIGN                                                   !3, $16
         19      > JMP                                                      ->41
   36    20    >   IS_EQUAL                                                 !2, 'subtract'
         21      > JMPZ                                                     ~18, ->28
   37    22    >   INIT_FCALL                                               'subtract'
         23        SEND_VAR                                                 !0
         24        SEND_VAR                                                 !1
         25        DO_FCALL                                      0  $19     
         26        ASSIGN                                                   !3, $19
         27      > JMP                                                      ->41
   40    28    >   IS_EQUAL                                                 !2, 'multiply'
         29      > JMPZ                                                     ~21, ->36
   41    30    >   INIT_FCALL                                               'multiply'
         31        SEND_VAR                                                 !0
         32        SEND_VAR                                                 !1
         33        DO_FCALL                                      0  $22     
         34        ASSIGN                                                   !3, $22
         35      > JMP                                                      ->41
   45    36    >   INIT_FCALL                                               'divide'
         37        SEND_VAR                                                 !0
         38        SEND_VAR                                                 !1
         39        DO_FCALL                                      0  $24     
         40        ASSIGN                                                   !3, $24
   52    41    >   ECHO                                                     '%0A%3Chtml%3E%0A%3Cbody%3E%0A%3Cform+action%3D%22%23%22+method%3D%22post%22%3E%0ANum1%3A%3Cinput+name%3D%22num1%22%3E%3Cbr%3E%0A%3Cinput+type%3D%27radio%27++name%3D%27express%27+value%3D%27add%27%3E%2B%0A%3Cinput+type%3D%27radio%27++name%3D%27express%27+value%3D%27subtract%27%3E-%0A%3Cinput+type%3D%27radio%27++name%3D%27express%27+value%3D%27multiply%27%3E%2A%0A%3Cinput+type%3D%27radio%27++name%3D%27express%27+value%3D%27divide%27%3E%2F%0A%3Cbr%3E%0ANum2%3A%3Cinput+name%3D%22num2%22%3E+%0AResult%3Cinput+value%3D%27'
   63    42        ISSET_ISEMPTY_CV                                         !3
         43      > JMPZ                                                     ~26, ->45
         44    >   ECHO                                                     !3
         45    >   ECHO                                                     '%27%3E%0A%3Cinput+type%3D%22submit%22+name%3D%22submit%22%3E%0A%3C%2Fform%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   68    46      > RETURN                                                   1

Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/usbrc
function name:  add
number of ops:  6
compiled vars:  !0 = $x, !1 = $y, !2 = $add
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ADD                                              ~3      !0, !1
          3        ASSIGN                                                   !2, ~3
    6     4      > RETURN                                                   !2
    8     5*     > RETURN                                                   null

End of function add

Function subtract:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/usbrc
function name:  subtract
number of ops:  6
compiled vars:  !0 = $x, !1 = $y, !2 = $subtract
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        SUB                                              ~3      !0, !1
          3        ASSIGN                                                   !2, ~3
   12     4      > RETURN                                                   !2
   14     5*     > RETURN                                                   null

End of function subtract

Function multiply:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/usbrc
function name:  multiply
number of ops:  6
compiled vars:  !0 = $x, !1 = $y, !2 = $multiply
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        MUL                                              ~3      !0, !1
          3        ASSIGN                                                   !2, ~3
   18     4      > RETURN                                                   !2
   20     5*     > RETURN                                                   null

End of function multiply

Function divide:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/usbrc
function name:  divide
number of ops:  6
compiled vars:  !0 = $x, !1 = $y, !2 = $divide
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   23     2        DIV                                              ~3      !0, !1
          3        ASSIGN                                                   !2, ~3
   24     4      > RETURN                                                   !2
   26     5*     > RETURN                                                   null

End of function divide

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.73 ms | 1411 KiB | 17 Q