3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new DateTime(); $interval = new DateInterval('P1M'); $dates = array(); for($i = 1; $i < 5; $i++){ $date->sub($interval); $dates[$i]=$date->format('Y-m-d'); } var_dump($dates); print $dates[4];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
Branch analysis from position: 10
filename:       /in/Jq1Wb
function name:  (null)
number of ops:  27
compiled vars:  !0 = $date, !1 = $interval, !2 = $dates, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'DateTime'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    4     3        NEW                                              $7      'DateInterval'
          4        SEND_VAL_EX                                              'P1M'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $7
    5     7        ASSIGN                                                   !2, <array>
    6     8        ASSIGN                                                   !3, 1
          9      > JMP                                                      ->19
    7    10    >   INIT_METHOD_CALL                                         !0, 'sub'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
    8    13        INIT_METHOD_CALL                                         !0, 'format'
         14        SEND_VAL_EX                                              'Y-m-d'
         15        DO_FCALL                                      0  $14     
         16        ASSIGN_DIM                                               !2, !3
         17        OP_DATA                                                  $14
    6    18        PRE_INC                                                  !3
         19    >   IS_SMALLER                                               !3, 5
         20      > JMPNZ                                                    ~16, ->10
   10    21    >   INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
   11    24        FETCH_DIM_R                                      ~18     !2, 4
         25        ECHO                                                     ~18
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.14 ms | 1387 KiB | 15 Q