3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _getRollingMonths($months = 12) { $dates = array(); for($i=$months-1;$i>=0;$i--) { $dates[] = array( 'year' => date('Y', strtotime("first day of -$i months")), 'month' => date('m', strtotime("first day of -$i months")), 'monthName' => date('M', strtotime("first day of -$i months")) ); } return $dates; } function debug($var) { echo "<pre>"; print_r($var); echo "</pre>"; } debug(_getRollingMonths(15));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/geKqq
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'debug'
          1        INIT_FCALL                                               '_getrollingmonths'
          2        SEND_VAL                                                 15
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Function _getrollingmonths:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 5
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 5
Branch analysis from position: 43
Branch analysis from position: 5
filename:       /in/geKqq
function name:  _getRollingMonths
number of ops:  45
compiled vars:  !0 = $months, !1 = $dates, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      12
    3     1        ASSIGN                                                   !1, <array>
    4     2        SUB                                              ~4      !0, 1
          3        ASSIGN                                                   !2, ~4
          4      > JMP                                                      ->41
    6     5    >   INIT_FCALL                                               'date'
          6        SEND_VAL                                                 'Y'
          7        INIT_FCALL                                               'strtotime'
          8        ROPE_INIT                                     3  ~8      'first+day+of+-'
          9        ROPE_ADD                                      1  ~8      ~8, !2
         10        ROPE_END                                      2  ~7      ~8, '+months'
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                         $10     
         13        SEND_VAR                                                 $10
         14        DO_ICALL                                         $11     
         15        INIT_ARRAY                                       ~12     $11, 'year'
    7    16        INIT_FCALL                                               'date'
         17        SEND_VAL                                                 'm'
         18        INIT_FCALL                                               'strtotime'
         19        ROPE_INIT                                     3  ~14     'first+day+of+-'
         20        ROPE_ADD                                      1  ~14     ~14, !2
         21        ROPE_END                                      2  ~13     ~14, '+months'
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                         $16     
         24        SEND_VAR                                                 $16
         25        DO_ICALL                                         $17     
         26        ADD_ARRAY_ELEMENT                                ~12     $17, 'month'
    8    27        INIT_FCALL                                               'date'
         28        SEND_VAL                                                 'M'
         29        INIT_FCALL                                               'strtotime'
         30        ROPE_INIT                                     3  ~19     'first+day+of+-'
         31        ROPE_ADD                                      1  ~19     ~19, !2
         32        ROPE_END                                      2  ~18     ~19, '+months'
         33        SEND_VAL                                                 ~18
         34        DO_ICALL                                         $21     
         35        SEND_VAR                                                 $21
         36        DO_ICALL                                         $22     
         37        ADD_ARRAY_ELEMENT                                ~12     $22, 'monthName'
    5    38        ASSIGN_DIM                                               !1
    8    39        OP_DATA                                                  ~12
    4    40        PRE_DEC                                                  !2
         41    >   IS_SMALLER_OR_EQUAL                                      0, !2
         42      > JMPNZ                                                    ~24, ->5
   12    43    > > RETURN                                                   !1
   13    44*     > RETURN                                                   null

End of function _getrollingmonths

Function debug:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/geKqq
function name:  debug
number of ops:  7
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        ECHO                                                     '%3Cpre%3E'
   17     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   18     5        ECHO                                                     '%3C%2Fpre%3E'
   19     6      > RETURN                                                   null

End of function debug

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.67 ms | 1403 KiB | 21 Q