3v4l.org

run code in 300+ PHP versions simultaneously
<?php $epoch = "1394031420"; $newepoch = time(); $start = new DateTime("@$epoch"); $start->modify('first day of this month'); $end = new DateTime("@$newepoch"); $end->modify('first day of next month'); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { echo $dt->format("M-d-y"); $newDate = strtotime('+15 days',$dt); echo strtotime(date("M-d-y", strtotime($dt)) . " +15 days"); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 56
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 56
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
filename:       /in/AW87e
function name:  (null)
number of ops:  58
compiled vars:  !0 = $epoch, !1 = $newepoch, !2 = $start, !3 = $end, !4 = $interval, !5 = $period, !6 = $dt, !7 = $newDate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, '1394031420'
    5     1        INIT_FCALL                                               'time'
          2        DO_ICALL                                         $9      
          3        ASSIGN                                                   !1, $9
    7     4        NEW                                              $11     'DateTime'
          5        NOP                                                      
          6        FAST_CONCAT                                      ~12     '%40', !0
          7        SEND_VAL_EX                                              ~12
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $11
    8    10        INIT_METHOD_CALL                                         !2, 'modify'
         11        SEND_VAL_EX                                              'first+day+of+this+month'
         12        DO_FCALL                                      0          
    9    13        NEW                                              $16     'DateTime'
         14        NOP                                                      
         15        FAST_CONCAT                                      ~17     '%40', !1
         16        SEND_VAL_EX                                              ~17
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !3, $16
   10    19        INIT_METHOD_CALL                                         !3, 'modify'
         20        SEND_VAL_EX                                              'first+day+of+next+month'
         21        DO_FCALL                                      0          
   11    22        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         23        SEND_VAL                                                 '1+month'
         24        DO_FCALL                                      0  $21     
         25        ASSIGN                                                   !4, $21
   12    26        NEW                                              $23     'DatePeriod'
         27        SEND_VAR_EX                                              !2
         28        SEND_VAR_EX                                              !4
         29        SEND_VAR_EX                                              !3
         30        DO_FCALL                                      0          
         31        ASSIGN                                                   !5, $23
   14    32      > FE_RESET_R                                       $26     !5, ->56
         33    > > FE_FETCH_R                                               $26, !6, ->56
   15    34    >   INIT_METHOD_CALL                                         !6, 'format'
         35        SEND_VAL_EX                                              'M-d-y'
         36        DO_FCALL                                      0  $27     
         37        ECHO                                                     $27
   16    38        INIT_FCALL                                               'strtotime'
         39        SEND_VAL                                                 '%2B15+days'
         40        SEND_VAR                                                 !6
         41        DO_ICALL                                         $28     
         42        ASSIGN                                                   !7, $28
   17    43        INIT_FCALL                                               'strtotime'
         44        INIT_FCALL                                               'date'
         45        SEND_VAL                                                 'M-d-y'
         46        INIT_FCALL                                               'strtotime'
         47        SEND_VAR                                                 !6
         48        DO_ICALL                                         $30     
         49        SEND_VAR                                                 $30
         50        DO_ICALL                                         $31     
         51        CONCAT                                           ~32     $31, '+%2B15+days'
         52        SEND_VAL                                                 ~32
         53        DO_ICALL                                         $33     
         54        ECHO                                                     $33
   14    55      > JMP                                                      ->33
         56    >   FE_FREE                                                  $26
   18    57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.72 ms | 1400 KiB | 19 Q