3v4l.org

run code in 300+ PHP versions simultaneously
<?php function date_generator($ex_weeks = array(), $ex_DateTimeObjects = array()) { $kanji_w = array('日', '月', '火', '水', '木', '金', '土'); $current = new DateTime('now', new DateTimezone('Asia/Tokyo')); for ($i = 0; $i < 30; $i++) { $current->add(new DateInterval('P1D')); if ($i < 2 || in_array($current->format('w'), $ex_weeks)) { continue; } foreach ($ex_DateTimeObjects as $object) { if (!$object->diff($current)->days) { continue 2; } } $w = $kanji_w[$current->format(' (w)')]; yield $current->format('n月j日') . $w; } } ?> <select name="date"> <?php foreach (date_generator(array(1), array(new DateTime('12/25'))) as $value): ?> <option value="<?=$value?>"><?=$value?></option> <?php endforeach; ?> </select>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/ntPVH
function name:  (null)
number of ops:  20
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ECHO                                                     '%3Cselect+name%3D%22date%22%3E%0A'
   23     1        INIT_FCALL                                               'date_generator'
          2        SEND_VAL                                                 <array>
          3        NEW                                              $1      'DateTime'
          4        SEND_VAL_EX                                              '12%2F25'
          5        DO_FCALL                                      0          
          6        INIT_ARRAY                                       ~3      $1
          7        SEND_VAL                                                 ~3
          8        DO_FCALL                                      0  $4      
          9      > FE_RESET_R                                       $5      $4, ->17
         10    > > FE_FETCH_R                                               $5, !0, ->17
   24    11    >   ECHO                                                     '%3Coption+value%3D%22'
         12        ECHO                                                     !0
         13        ECHO                                                     '%22%3E'
         14        ECHO                                                     !0
         15        ECHO                                                     '%3C%2Foption%3E%0A'
   23    16      > JMP                                                      ->10
         17    >   FE_FREE                                                  $5
   26    18        ECHO                                                     '%3C%2Fselect%3E'
         19      > RETURN                                                   1

Function date_generator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 14
Branch analysis from position: 57
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 47) Position 1 = 22, Position 2 = 30
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 32
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 14
Branch analysis from position: 57
Branch analysis from position: 14
Branch analysis from position: 32
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 43
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 43
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 42
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 14
Branch analysis from position: 57
Branch analysis from position: 14
Branch analysis from position: 43
Branch analysis from position: 30
filename:       /in/ntPVH
function name:  date_generator
number of ops:  58
compiled vars:  !0 = $ex_weeks, !1 = $ex_DateTimeObjects, !2 = $kanji_w, !3 = $current, !4 = $i, !5 = $object, !6 = $w
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      <array>
          1        RECV_INIT                                        !1      <array>
          2        GENERATOR_CREATE                                         
    4     3        ASSIGN                                                   !2, <array>
    5     4        NEW                                              $8      'DateTime'
          5        SEND_VAL_EX                                              'now'
          6        NEW                                              $9      'DateTimezone'
          7        SEND_VAL_EX                                              'Asia%2FTokyo'
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $9
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !3, $8
    6    12        ASSIGN                                                   !4, 0
         13      > JMP                                                      ->55
    7    14    >   INIT_METHOD_CALL                                         !3, 'add'
         15        NEW                                              $14     'DateInterval'
         16        SEND_VAL_EX                                              'P1D'
         17        DO_FCALL                                      0          
         18        SEND_VAR_NO_REF_EX                                       $14
         19        DO_FCALL                                      0          
    8    20        IS_SMALLER                                       ~17     !4, 2
         21      > JMPNZ_EX                                         ~17     ~17, ->30
         22    >   INIT_FCALL                                               'in_array'
         23        INIT_METHOD_CALL                                         !3, 'format'
         24        SEND_VAL_EX                                              'w'
         25        DO_FCALL                                      0  $18     
         26        SEND_VAR                                                 $18
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                         $19     
         29        BOOL                                             ~17     $19
         30    > > JMPZ                                                     ~17, ->32
    9    31    > > JMP                                                      ->54
   11    32    > > FE_RESET_R                                       $20     !1, ->43
         33    > > FE_FETCH_R                                               $20, !5, ->43
   12    34    >   INIT_METHOD_CALL                                         !5, 'diff'
         35        SEND_VAR_EX                                              !3
         36        DO_FCALL                                      0  $21     
         37        FETCH_OBJ_R                                      ~22     $21, 'days'
         38        BOOL_NOT                                         ~23     ~22
         39      > JMPZ                                                     ~23, ->42
   13    40    >   FE_FREE                                                  $20
         41      > JMP                                                      ->54
   11    42    > > JMP                                                      ->33
         43    >   FE_FREE                                                  $20
   16    44        INIT_METHOD_CALL                                         !3, 'format'
         45        SEND_VAL_EX                                              '+%28w%29'
         46        DO_FCALL                                      0  $24     
         47        FETCH_DIM_R                                      ~25     !2, $24
         48        ASSIGN                                                   !6, ~25
   17    49        INIT_METHOD_CALL                                         !3, 'format'
         50        SEND_VAL_EX                                              'n%E6%9C%88j%E6%97%A5'
         51        DO_FCALL                                      0  $27     
         52        CONCAT                                           ~28     $27, !6
         53        YIELD                                                    ~28
    6    54    >   PRE_INC                                                  !4
         55    >   IS_SMALLER                                               !4, 30
         56      > JMPNZ                                                    ~31, ->14
   19    57    > > GENERATOR_RETURN                                         

End of function date_generator

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.96 ms | 1398 KiB | 16 Q