3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dates = array( '2015-11-30', '2015-12-01', '2015-12-07', '2015-12-14', '2015-12-21', '2015-12-28', '2015-12-31', '2016-01-01', '2016-01-07', '2016-01-14', '2016-01-31', ); print_r($dates); echo '--------'; foreach ($dates as $date) { $datetime = new DateTime($date); $datetime1 = clone $datetime; $datetime2 = clone $datetime; $modified = clone $datetime; date_modify($modified, '+1 week'); print_r(array( $date, $modified, $datetime->modify('+1 week'), $datetime1->modify('next week'), $datetime2->modify('last day of next week'), )); }

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 39
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 39
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/94PBa
function name:  (null)
number of ops:  41
compiled vars:  !0 = $dates, !1 = $date, !2 = $datetime, !3 = $datetime1, !4 = $datetime2, !5 = $modified
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   17     1        INIT_FCALL                                                   'print_r'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                                     
   18     4        ECHO                                                         '--------'
   19     5      > FE_RESET_R                                           $8      !0, ->39
          6    > > FE_FETCH_R                                                   $8, !1, ->39
   20     7    >   NEW                                                  $9      'DateTime'
          8        SEND_VAR_EX                                                  !1
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !2, $9
   21    11        CLONE                                                ~12     !2
         12        ASSIGN                                                       !3, ~12
   22    13        CLONE                                                ~14     !2
         14        ASSIGN                                                       !4, ~14
   24    15        CLONE                                                ~16     !2
         16        ASSIGN                                                       !5, ~16
   25    17        INIT_FCALL                                                   'date_modify'
         18        SEND_VAR                                                     !5
         19        SEND_VAL                                                     '%2B1+week'
         20        DO_ICALL                                                     
   27    21        INIT_FCALL                                                   'print_r'
   28    22        INIT_ARRAY                                           ~19     !1
   29    23        ADD_ARRAY_ELEMENT                                    ~19     !5
   30    24        INIT_METHOD_CALL                                             !2, 'modify'
         25        SEND_VAL_EX                                                  '%2B1+week'
         26        DO_FCALL                                          0  $20     
         27        ADD_ARRAY_ELEMENT                                    ~19     $20
   31    28        INIT_METHOD_CALL                                             !3, 'modify'
         29        SEND_VAL_EX                                                  'next+week'
         30        DO_FCALL                                          0  $21     
         31        ADD_ARRAY_ELEMENT                                    ~19     $21
   32    32        INIT_METHOD_CALL                                             !4, 'modify'
         33        SEND_VAL_EX                                                  'last+day+of+next+week'
         34        DO_FCALL                                          0  $22     
         35        ADD_ARRAY_ELEMENT                                    ~19     $22
         36        SEND_VAL                                                     ~19
   27    37        DO_ICALL                                                     
   19    38      > JMP                                                          ->6
         39    >   FE_FREE                                                      $8
   34    40      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
240.97 ms | 4914 KiB | 15 Q