3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = "2001-01-01"; $b = "2016-02-15"; $i = date("Y", strtotime($a)); $result = array($i); while($i <= date("Y", strtotime($b))){ echo $i."\n"; array_push($result, $i); if(substr($i, 4, 2) == "12"){ $i = (date("Y", strtotime($i."01")) + 1); } else{ $i++; } } $result = array_slice($result, -10, 10, true); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 13
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 37
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 13
Branch analysis from position: 47
Branch analysis from position: 13
filename:       /in/IikRs
function name:  (null)
number of ops:  58
compiled vars:  !0 = $a, !1 = $b, !2 = $i, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2001-01-01'
    4     1        ASSIGN                                                   !1, '2016-02-15'
    6     2        INIT_FCALL                                               'date'
          3        SEND_VAL                                                 'Y'
          4        INIT_FCALL                                               'strtotime'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !2, $7
    7    10        INIT_ARRAY                                       ~9      !2
         11        ASSIGN                                                   !3, ~9
    8    12      > JMP                                                      ->38
    9    13    >   CONCAT                                           ~11     !2, '%0A'
         14        ECHO                                                     ~11
   10    15        INIT_FCALL                                               'array_push'
         16        SEND_REF                                                 !3
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   11    19        INIT_FCALL                                               'substr'
         20        SEND_VAR                                                 !2
         21        SEND_VAL                                                 4
         22        SEND_VAL                                                 2
         23        DO_ICALL                                         $13     
         24        IS_EQUAL                                                 $13, '12'
         25      > JMPZ                                                     ~14, ->37
   12    26    >   INIT_FCALL                                               'date'
         27        SEND_VAL                                                 'Y'
         28        INIT_FCALL                                               'strtotime'
         29        CONCAT                                           ~15     !2, '01'
         30        SEND_VAL                                                 ~15
         31        DO_ICALL                                         $16     
         32        SEND_VAR                                                 $16
         33        DO_ICALL                                         $17     
         34        ADD                                              ~18     $17, 1
         35        ASSIGN                                                   !2, ~18
         36      > JMP                                                      ->38
   15    37    >   PRE_INC                                                  !2
    8    38    >   INIT_FCALL                                               'date'
         39        SEND_VAL                                                 'Y'
         40        INIT_FCALL                                               'strtotime'
         41        SEND_VAR                                                 !1
         42        DO_ICALL                                         $21     
         43        SEND_VAR                                                 $21
         44        DO_ICALL                                         $22     
         45        IS_SMALLER_OR_EQUAL                                      !2, $22
         46      > JMPNZ                                                    ~23, ->13
   19    47    >   INIT_FCALL                                               'array_slice'
         48        SEND_VAR                                                 !3
         49        SEND_VAL                                                 -10
         50        SEND_VAL                                                 10
         51        SEND_VAL                                                 <true>
         52        DO_ICALL                                         $24     
         53        ASSIGN                                                   !3, $24
   21    54        INIT_FCALL                                               'print_r'
         55        SEND_VAR                                                 !3
         56        DO_ICALL                                                 
         57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.56 ms | 1400 KiB | 25 Q