3v4l.org

run code in 300+ PHP versions simultaneously
<?php function year_select($name,$start_year,$end_year=NULL,$selected_year=NULL,$html_attrs=array()){ $end_year = (isset($end_year))? $end_year : date('Y'); $html_attributes = ""; if(count($html_attrs)>0) { foreach($html_attrs as $attr=>$val){ $html_attributes.=" $attr='$val'"; } } $select = "<select name='$name' $html_attributes><option>Select</option>"; for($i=$end_year;$i>=$start_year;$i--) { $selected=(isset($selected_year) && $selected_year==$i)? " selected='selected' " : ""; $select.="<option value='$i' $selected>$i</option>"; } $select.="</select>"; return $select; } year_select("hi",2003);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2gJWs
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'year_select'
          1        SEND_VAL                                                 'hi'
          2        SEND_VAL                                                 2003
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function year_select:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 29
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 28
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 28
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 37
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
2 jumps found. (Code = 46) Position 1 = 39, Position 2 = 41
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 44
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 37
Branch analysis from position: 57
Branch analysis from position: 37
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 37
Branch analysis from position: 57
Branch analysis from position: 37
Branch analysis from position: 41
Branch analysis from position: 28
Branch analysis from position: 29
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 29
Branch analysis from position: 18
Branch analysis from position: 29
filename:       /in/2gJWs
function name:  year_select
number of ops:  60
compiled vars:  !0 = $name, !1 = $start_year, !2 = $end_year, !3 = $selected_year, !4 = $html_attrs, !5 = $html_attributes, !6 = $val, !7 = $attr, !8 = $select, !9 = $i, !10 = $selected
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      null
          3        RECV_INIT                                        !3      null
          4        RECV_INIT                                        !4      <array>
    3     5        ISSET_ISEMPTY_CV                                         !2
          6      > JMPZ                                                     ~11, ->9
          7    >   QM_ASSIGN                                        ~12     !2
          8      > JMP                                                      ->13
          9    >   INIT_FCALL                                               'date'
         10        SEND_VAL                                                 'Y'
         11        DO_ICALL                                         $13     
         12        QM_ASSIGN                                        ~12     $13
         13    >   ASSIGN                                                   !2, ~12
    4    14        ASSIGN                                                   !5, ''
    5    15        COUNT                                            ~16     !4
         16        IS_SMALLER                                               0, ~16
         17      > JMPZ                                                     ~17, ->29
    7    18    > > FE_RESET_R                                       $18     !4, ->28
         19    > > FE_FETCH_R                                       ~19     $18, !6, ->28
         20    >   ASSIGN                                                   !7, ~19
    8    21        ROPE_INIT                                     5  ~22     '+'
         22        ROPE_ADD                                      1  ~22     ~22, !7
         23        ROPE_ADD                                      2  ~22     ~22, '%3D%27'
         24        ROPE_ADD                                      3  ~22     ~22, !6
         25        ROPE_END                                      4  ~21     ~22, '%27'
         26        ASSIGN_OP                                     8          !5, ~21
    7    27      > JMP                                                      ->19
         28    >   FE_FREE                                                  $18
   11    29    >   ROPE_INIT                                     5  ~27     '%3Cselect+name%3D%27'
         30        ROPE_ADD                                      1  ~27     ~27, !0
         31        ROPE_ADD                                      2  ~27     ~27, '%27+'
         32        ROPE_ADD                                      3  ~27     ~27, !5
         33        ROPE_END                                      4  ~26     ~27, '%3E%3Coption%3ESelect%3C%2Foption%3E'
         34        ASSIGN                                                   !8, ~26
   12    35        ASSIGN                                                   !9, !2
         36      > JMP                                                      ->55
   14    37    >   ISSET_ISEMPTY_CV                                 ~32     !3
         38      > JMPZ_EX                                          ~32     ~32, ->41
         39    >   IS_EQUAL                                         ~33     !3, !9
         40        BOOL                                             ~32     ~33
         41    > > JMPZ                                                     ~32, ->44
         42    >   QM_ASSIGN                                        ~34     '+selected%3D%27selected%27+'
         43      > JMP                                                      ->45
         44    >   QM_ASSIGN                                        ~34     ''
         45    >   ASSIGN                                                   !10, ~34
   15    46        ROPE_INIT                                     7  ~37     '%3Coption+value%3D%27'
         47        ROPE_ADD                                      1  ~37     ~37, !9
         48        ROPE_ADD                                      2  ~37     ~37, '%27+'
         49        ROPE_ADD                                      3  ~37     ~37, !10
         50        ROPE_ADD                                      4  ~37     ~37, '%3E'
         51        ROPE_ADD                                      5  ~37     ~37, !9
         52        ROPE_END                                      6  ~36     ~37, '%3C%2Foption%3E'
         53        ASSIGN_OP                                     8          !8, ~36
   12    54        PRE_DEC                                                  !9
         55    >   IS_SMALLER_OR_EQUAL                                      !1, !9
         56      > JMPNZ                                                    ~43, ->37
   17    57    >   ASSIGN_OP                                     8          !8, '%3C%2Fselect%3E'
   18    58      > RETURN                                                   !8
   19    59*     > RETURN                                                   null

End of function year_select

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.95 ms | 1394 KiB | 16 Q