3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getSundays($y, $m) { return new DatePeriod( new DateTime("first Sunday of $y-$m"), DateInterval::createFromDateString('next sunday'), new DateTime("last day of $y-$m") ); } $days=""; foreach (getSundays(2016, 04) as $Sunday) { $days[] = $Sunday->format("d"); } var_dump($days);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/DVYM5
function name:  (null)
number of ops:  18
compiled vars:  !0 = $days, !1 = $Sunday
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, ''
   13     1        INIT_FCALL                                               'getsundays'
          2        SEND_VAL                                                 2016
          3        SEND_VAL                                                 4
          4        DO_FCALL                                      0  $3      
          5      > FE_RESET_R                                       $4      $3, ->13
          6    > > FE_FETCH_R                                               $4, !1, ->13
   14     7    >   INIT_METHOD_CALL                                         !1, 'format'
          8        SEND_VAL_EX                                              'd'
          9        DO_FCALL                                      0  $6      
         10        ASSIGN_DIM                                               !0
         11        OP_DATA                                                  $6
   13    12      > JMP                                                      ->6
         13    >   FE_FREE                                                  $4
   17    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function getsundays:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DVYM5
function name:  getSundays
number of ops:  26
compiled vars:  !0 = $y, !1 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        NEW                                              $2      'DatePeriod'
    6     3        NEW                                              $3      'DateTime'
          4        ROPE_INIT                                     4  ~5      'first+Sunday+of+'
          5        ROPE_ADD                                      1  ~5      ~5, !0
          6        ROPE_ADD                                      2  ~5      ~5, '-'
          7        ROPE_END                                      3  ~4      ~5, !1
          8        SEND_VAL_EX                                              ~4
          9        DO_FCALL                                      0          
         10        SEND_VAR_NO_REF_EX                                       $3
    7    11        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         12        SEND_VAL                                                 'next+sunday'
         13        DO_FCALL                                      0  $8      
         14        SEND_VAR_NO_REF_EX                                       $8
    8    15        NEW                                              $9      'DateTime'
         16        ROPE_INIT                                     4  ~11     'last+day+of+'
         17        ROPE_ADD                                      1  ~11     ~11, !0
         18        ROPE_ADD                                      2  ~11     ~11, '-'
         19        ROPE_END                                      3  ~10     ~11, !1
         20        SEND_VAL_EX                                              ~10
         21        DO_FCALL                                      0          
         22        SEND_VAR_NO_REF_EX                                       $9
         23        DO_FCALL                                      0          
         24      > RETURN                                                   $2
   10    25*     > RETURN                                                   null

End of function getsundays

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.75 ms | 1403 KiB | 16 Q