3v4l.org

run code in 300+ PHP versions simultaneously
<?php $select_options = array("foo"=>"bar", "foo2"=>"bar2", "foo3"=>"bar3"); function generateSelect($name = '', $options = array()) { $html = '<select name="'.$name.'">'; foreach ($options as $option => $value) { $html .= '<option value=' .'"' .$value . '"'. blah($name, "bar") . '>'.$option.'</option>'; } $html .= '</select>'; return $html; } function blah($varname, $varvalue) { if ($_POST[$varname] == $varvalue) { return " selected"; } } ?> <form> <?php generateSelect("", $select_options); ?> <input type="submit" name="submitdata" value="Update"> </form>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cj199
function name:  (null)
number of ops:  8
compiled vars:  !0 = $select_options
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   25     1        ECHO                                                     '%0A%3Cform%3E%0A%0A'
   29     2        INIT_FCALL                                               'generateselect'
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0          
   31     6        ECHO                                                     '%0A%3Cinput+type%3D%22submit%22+name%3D%22submitdata%22+value%3D%22Update%22%3E%0A%3C%2Fform%3E'
   33     7      > RETURN                                                   1

Function generateselect:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/cj199
function name:  generateSelect
number of ops:  24
compiled vars:  !0 = $name, !1 = $options, !2 = $html, !3 = $value, !4 = $option
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      ''
          1        RECV_INIT                                        !1      <array>
    8     2        CONCAT                                           ~5      '%3Cselect+name%3D%22', !0
          3        CONCAT                                           ~6      ~5, '%22%3E'
          4        ASSIGN                                                   !2, ~6
    9     5      > FE_RESET_R                                       $8      !1, ->20
          6    > > FE_FETCH_R                                       ~9      $8, !3, ->20
          7    >   ASSIGN                                                   !4, ~9
   10     8        CONCAT                                           ~11     '%3Coption+value%3D%22', !3
          9        CONCAT                                           ~12     ~11, '%22'
         10        INIT_FCALL_BY_NAME                                       'blah'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAL_EX                                              'bar'
         13        DO_FCALL                                      0  $13     
         14        CONCAT                                           ~14     ~12, $13
         15        CONCAT                                           ~15     ~14, '%3E'
         16        CONCAT                                           ~16     ~15, !4
         17        CONCAT                                           ~17     ~16, '%3C%2Foption%3E'
         18        ASSIGN_OP                                     8          !2, ~17
    9    19      > JMP                                                      ->6
         20    >   FE_FREE                                                  $8
   12    21        ASSIGN_OP                                     8          !2, '%3C%2Fselect%3E'
   13    22      > RETURN                                                   !2
   14    23*     > RETURN                                                   null

End of function generateselect

Function blah:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cj199
function name:  blah
number of ops:  8
compiled vars:  !0 = $varname, !1 = $varvalue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   20     2        FETCH_R                      global              ~2      '_POST'
          3        FETCH_DIM_R                                      ~3      ~2, !0
          4        IS_EQUAL                                                 !1, ~3
          5      > JMPZ                                                     ~4, ->7
   21     6    > > RETURN                                                   '+selected'
   22     7    > > RETURN                                                   null

End of function blah

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.14 ms | 1403 KiB | 14 Q