3v4l.org

run code in 300+ PHP versions simultaneously
<?php function select_ts_hour($ts=NULL, $var='hour', $offset_day=0){ if (empty($ts)) { $ts = mktime(0,0,0,date("m"),date("d")+$offset_day,date("Y")); } $selected = date("H",$ts); select_hour($selected, $var); } function select_hour($selected=NULL, $var='hour'){ echo '<select name="'.$var.'" id="'.$var.'">'; for($i=0;$i<=23;$i++){ echo '<option value="'.substr($i+100,1).'"'; if ($selected == substr($i+100,1)) { echo ' selected="selected" '; } echo '>'.substr($i+100,1).'</option>'; } echo '</select>'; } echo select_ts_hour('1398441600', 'started_hour');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NJMr
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'select_ts_hour'
          1        SEND_VAL                                                 '1398441600'
          2        SEND_VAL                                                 'started_hour'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function select_ts_hour:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 24
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/8NJMr
function name:  select_ts_hour
number of ops:  34
compiled vars:  !0 = $ts, !1 = $var, !2 = $offset_day, !3 = $selected
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      null
          1        RECV_INIT                                        !1      'hour'
          2        RECV_INIT                                        !2      0
    3     3        ISSET_ISEMPTY_CV                                         !0
          4      > JMPZ                                                     ~4, ->24
    4     5    >   INIT_FCALL                                               'mktime'
          6        SEND_VAL                                                 0
          7        SEND_VAL                                                 0
          8        SEND_VAL                                                 0
          9        INIT_FCALL                                               'date'
         10        SEND_VAL                                                 'm'
         11        DO_ICALL                                         $5      
         12        SEND_VAR                                                 $5
         13        INIT_FCALL                                               'date'
         14        SEND_VAL                                                 'd'
         15        DO_ICALL                                         $6      
         16        ADD                                              ~7      $6, !2
         17        SEND_VAL                                                 ~7
         18        INIT_FCALL                                               'date'
         19        SEND_VAL                                                 'Y'
         20        DO_ICALL                                         $8      
         21        SEND_VAR                                                 $8
         22        DO_ICALL                                         $9      
         23        ASSIGN                                                   !0, $9
    6    24    >   INIT_FCALL                                               'date'
         25        SEND_VAL                                                 'H'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                         $11     
         28        ASSIGN                                                   !3, $11
    7    29        INIT_FCALL_BY_NAME                                       'select_hour'
         30        SEND_VAR_EX                                              !3
         31        SEND_VAR_EX                                              !1
         32        DO_FCALL                                      0          
    8    33      > RETURN                                                   null

End of function select_ts_hour

Function select_hour:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 9
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 9
Branch analysis from position: 36
Branch analysis from position: 9
Branch analysis from position: 25
filename:       /in/8NJMr
function name:  select_hour
number of ops:  38
compiled vars:  !0 = $selected, !1 = $var, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV_INIT                                        !0      null
          1        RECV_INIT                                        !1      'hour'
   11     2        CONCAT                                           ~3      '%3Cselect+name%3D%22', !1
          3        CONCAT                                           ~4      ~3, '%22+id%3D%22'
          4        CONCAT                                           ~5      ~4, !1
          5        CONCAT                                           ~6      ~5, '%22%3E'
          6        ECHO                                                     ~6
   12     7        ASSIGN                                                   !2, 0
          8      > JMP                                                      ->34
   13     9    >   INIT_FCALL                                               'substr'
         10        ADD                                              ~8      !2, 100
         11        SEND_VAL                                                 ~8
         12        SEND_VAL                                                 1
         13        DO_ICALL                                         $9      
         14        CONCAT                                           ~10     '%3Coption+value%3D%22', $9
         15        CONCAT                                           ~11     ~10, '%22'
         16        ECHO                                                     ~11
   14    17        INIT_FCALL                                               'substr'
         18        ADD                                              ~12     !2, 100
         19        SEND_VAL                                                 ~12
         20        SEND_VAL                                                 1
         21        DO_ICALL                                         $13     
         22        IS_EQUAL                                                 !0, $13
         23      > JMPZ                                                     ~14, ->25
   15    24    >   ECHO                                                     '+selected%3D%22selected%22+'
   17    25    >   INIT_FCALL                                               'substr'
         26        ADD                                              ~15     !2, 100
         27        SEND_VAL                                                 ~15
         28        SEND_VAL                                                 1
         29        DO_ICALL                                         $16     
         30        CONCAT                                           ~17     '%3E', $16
         31        CONCAT                                           ~18     ~17, '%3C%2Foption%3E'
         32        ECHO                                                     ~18
   12    33        PRE_INC                                                  !2
         34    >   IS_SMALLER_OR_EQUAL                                      !2, 23
         35      > JMPNZ                                                    ~20, ->9
   19    36    >   ECHO                                                     '%3C%2Fselect%3E'
   20    37      > RETURN                                                   null

End of function select_hour

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.82 ms | 1407 KiB | 20 Q