3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Wrong DateInterval first Monday of January 2020, it progress year (+1, +2, etc) not have start or end this class. $timezone = new DateTimeZone( "UTC" ); $fmj = DateInterval::createFromDateString( 'first Monday of next month' ); $period = new DatePeriod( new DateTime( '2019-01-01 00:00:00.000000', $timezone ), $fmj, new DateTime( '2022-01-11 00:00:00.000000', $timezone ) ); $y = 0; foreach ( $period as $dt ) { $c[] = $period; $display[$y++] = $dt->format( "l Y-m-d H:i:s" ); //stop total_recurrence if( $y == 36 ) { break; } } $var = new DateTime( 'first monday of January', new DateTimeZone( "UTC" )); $display[36] = 'this relative date for DateTime class ' . ($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/R8dL6
function name:  (null)
number of ops:  58
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
-------------------------------------------------------------------------------------
    4     0  E >   NEW                                              $8      'DateTimeZone'
          1        SEND_VAL_EX                                              'UTC'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $8
    5     4        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
          5        SEND_VAL                                                 'first+Monday+of+next+month'
          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
    7    22        ASSIGN                                                   !3, 0
    8    23      > FE_RESET_R                                       $21     !2, ->37
         24    > > FE_FETCH_R                                               $21, !4, ->37
    9    25    >   ASSIGN_DIM                                               !5
         26        OP_DATA                                                  !2
   10    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
   12    33        IS_EQUAL                                                 !3, 36
         34      > JMPZ                                                     ~26, ->36
   13    35    > > JMP                                                      ->37
    8    36    > > JMP                                                      ->24
         37    >   FE_FREE                                                  $21
   16    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
   17    46        INIT_METHOD_CALL                                         !7, 'format'
         47        SEND_VAL_EX                                              'l+Y-m-d+H%3Ai%3As'
         48        DO_FCALL                                      0  $33     
         49        CONCAT                                           ~34     'this+relative+date+for+DateTime+class+', $33
         50        ASSIGN_DIM                                               !6, 36
         51        OP_DATA                                                  ~34
   18    52        INIT_FCALL                                               'var_dump'
         53        SEND_VAR                                                 !6
         54        SEND_VAR                                                 !1
         55        SEND_VAR                                                 !5
         56        DO_ICALL                                                 
         57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.05 ms | 1400 KiB | 15 Q