3v4l.org

run code in 300+ PHP versions simultaneously
<?php $timezone = new DateTimeZone( "UTC" ); $fmj = DateInterval::createFromDateString( 'first Monday of January next year' ); //Monday from start 2019 only $period = new DatePeriod( new DateTime( '2019-01-01 00:00:00.000000', $timezone ), $fmj, new DateTime( '2022-01-11 00:00:00.000000', $timezone ) ); //$period->current= new \DateTime('2019-05-06 00:00:00', new \DateTimeZone('UTC')); $y = 0; foreach ( $period as $dt ) { $c[] = $period; $display[$y++] = $dt->format( "l Y-m-d H:i:s" ); //stop total_recurrence if( $y == 5 ) { break; } } $var = new DateTime( 'first monday of January', new DateTimeZone( "UTC" )); $display[5] = $var->format( "l Y-m-d H:i:s" ); var_dump( $display, $fmj, $c);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 37
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 37
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 37
Branch analysis from position: 37
filename:       /in/uJpiU
function name:  (null)
number of ops:  57
compiled vars:  !0 = $timezone, !1 = $fmj, !2 = $period, !3 = $y, !4 = $dt, !5 = $c, !6 = $display, !7 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $8      'DateTimeZone'
          1        SEND_VAL_EX                                              'UTC'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $8
    4     4        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
          5        SEND_VAL                                                 'first+Monday+of+January+next+year'
          6        DO_FCALL                                      0  $11     
          7        ASSIGN                                                   !1, $11
    6     8        NEW                                              $13     'DatePeriod'
          9        NEW                                              $14     'DateTime'
         10        SEND_VAL_EX                                              '2019-01-01+00%3A00%3A00.000000'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0          
         13        SEND_VAR_NO_REF_EX                                       $14
         14        SEND_VAR_EX                                              !1
         15        NEW                                              $16     'DateTime'
         16        SEND_VAL_EX                                              '2022-01-11+00%3A00%3A00.000000'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0          
         19        SEND_VAR_NO_REF_EX                                       $16
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !2, $13
    8    22        ASSIGN                                                   !3, 0
    9    23      > FE_RESET_R                                       $21     !2, ->37
         24    > > FE_FETCH_R                                               $21, !4, ->37
   10    25    >   ASSIGN_DIM                                               !5
         26        OP_DATA                                                  !2
   11    27        POST_INC                                         ~23     !3
         28        INIT_METHOD_CALL                                         !4, 'format'
         29        SEND_VAL_EX                                              'l+Y-m-d+H%3Ai%3As'
         30        DO_FCALL                                      0  $25     
         31        ASSIGN_DIM                                               !6, ~23
         32        OP_DATA                                                  $25
   13    33        IS_EQUAL                                                 !3, 5
         34      > JMPZ                                                     ~26, ->36
   14    35    > > JMP                                                      ->37
    9    36    > > JMP                                                      ->24
         37    >   FE_FREE                                                  $21
   17    38        NEW                                              $27     'DateTime'
         39        SEND_VAL_EX                                              'first+monday+of+January'
         40        NEW                                              $28     'DateTimeZone'
         41        SEND_VAL_EX                                              'UTC'
         42        DO_FCALL                                      0          
         43        SEND_VAR_NO_REF_EX                                       $28
         44        DO_FCALL                                      0          
         45        ASSIGN                                                   !7, $27
   18    46        INIT_METHOD_CALL                                         !7, 'format'
         47        SEND_VAL_EX                                              'l+Y-m-d+H%3Ai%3As'
         48        DO_FCALL                                      0  $33     
         49        ASSIGN_DIM                                               !6, 5
         50        OP_DATA                                                  $33
   19    51        INIT_FCALL                                               'var_dump'
         52        SEND_VAR                                                 !6
         53        SEND_VAR                                                 !1
         54        SEND_VAR                                                 !5
         55        DO_ICALL                                                 
         56      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.69 ms | 1400 KiB | 15 Q