3v4l.org

run code in 500+ PHP versions simultaneously
<?php error_reporting(-1); $st_date = '2020-10-01'; $ed_date = '2020-10-31'; $min = strtotime($st_date); $copy_min = $min; $start = new DateTime($st_date, new DateTimeZone('Europe/Rome')); $interval = new DateInterval('P1D'); $recurrence = 30; $period = new DatePeriod($start, $interval, $recurrence); foreach ($period as $date) { $test[] = $date->format('U'); } $i = 0; while($i < 31) { $array[$i] = $min; $min = strtotime('+1 day', $min); $i++; } $min = $copy_min; $range = array_map("toDate", $array); print_r($range); $range_period = array_map("toDate", $test); print_r($range_period); function toDate($x){return date('Y-m-d H:i:s', $x);}
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 30, Position 2 = 37
Branch analysis from position: 30
2 jumps found. (Code = 78) Position 1 = 31, Position 2 = 37
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 40
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 40
Branch analysis from position: 50
Branch analysis from position: 40
Branch analysis from position: 37
filename:       /in/Lc58h
function name:  (null)
number of ops:  68
compiled vars:  !0 = $st_date, !1 = $ed_date, !2 = $min, !3 = $copy_min, !4 = $start, !5 = $interval, !6 = $recurrence, !7 = $period, !8 = $date, !9 = $test, !10 = $i, !11 = $array, !12 = $range, !13 = $range_period
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'error_reporting'
          1        SEND_VAL                                                     -1
          2        DO_ICALL                                                     
    4     3        ASSIGN                                                       !0, '2020-10-01'
    5     4        ASSIGN                                                       !1, '2020-10-31'
    6     5        INIT_FCALL                                                   'strtotime'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                             $17     
          8        ASSIGN                                                       !2, $17
    7     9        ASSIGN                                                       !3, !2
    9    10        NEW                                                  $20     'DateTime'
         11        SEND_VAR_EX                                                  !0
         12        NEW                                                  $21     'DateTimeZone'
         13        SEND_VAL_EX                                                  'Europe%2FRome'
         14        DO_FCALL                                          0          
         15        SEND_VAR_NO_REF_EX                                           $21
         16        DO_FCALL                                          0          
         17        ASSIGN                                                       !4, $20
   10    18        NEW                                                  $25     'DateInterval'
         19        SEND_VAL_EX                                                  'P1D'
         20        DO_FCALL                                          0          
         21        ASSIGN                                                       !5, $25
   11    22        ASSIGN                                                       !6, 30
   12    23        NEW                                                  $29     'DatePeriod'
         24        SEND_VAR_EX                                                  !4
         25        SEND_VAR_EX                                                  !5
         26        SEND_VAR_EX                                                  !6
         27        DO_FCALL                                          0          
         28        ASSIGN                                                       !7, $29
   13    29      > FE_RESET_R                                           $32     !7, ->37
         30    > > FE_FETCH_R                                                   $32, !8, ->37
   14    31    >   INIT_METHOD_CALL                                             !8, 'format'
         32        SEND_VAL_EX                                                  'U'
         33        DO_FCALL                                          0  $34     
         34        ASSIGN_DIM                                                   !9
         35        OP_DATA                                                      $34
   13    36      > JMP                                                          ->30
         37    >   FE_FREE                                                      $32
   17    38        ASSIGN                                                       !10, 0
   18    39      > JMP                                                          ->48
   19    40    >   ASSIGN_DIM                                                   !11, !10
         41        OP_DATA                                                      !2
   20    42        INIT_FCALL                                                   'strtotime'
         43        SEND_VAL                                                     '%2B1+day'
         44        SEND_VAR                                                     !2
         45        DO_ICALL                                             $37     
         46        ASSIGN                                                       !2, $37
   21    47        PRE_INC                                                      !10
   18    48    >   IS_SMALLER                                                   !10, 31
         49      > JMPNZ                                                        ~40, ->40
   23    50    >   ASSIGN                                                       !2, !3
   26    51        INIT_FCALL                                                   'array_map'
         52        SEND_VAL                                                     'toDate'
         53        SEND_VAR                                                     !11
         54        DO_ICALL                                             $42     
         55        ASSIGN                                                       !12, $42
   27    56        INIT_FCALL                                                   'print_r'
         57        SEND_VAR                                                     !12
         58        DO_ICALL                                                     
   28    59        INIT_FCALL                                                   'array_map'
         60        SEND_VAL                                                     'toDate'
         61        SEND_VAR                                                     !9
         62        DO_ICALL                                             $45     
         63        ASSIGN                                                       !13, $45
   29    64        INIT_FCALL                                                   'print_r'
         65        SEND_VAR                                                     !13
         66        DO_ICALL                                                     
   30    67      > RETURN                                                       1

Function todate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Lc58h
function name:  toDate
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
          0  E >   RECV                                                 !0      
          1        INIT_FCALL                                                   'date'
          2        SEND_VAL                                                     'Y-m-d+H%3Ai%3As'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $1      
          5      > RETURN                                                       $1
          6*     > RETURN                                                       null

End of function todate

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
146.81 ms | 2644 KiB | 17 Q