3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _getRollingMonths($months = 12) { $currentTime = strtotime('2015-03-01'); $dates = array(); for($i=$months-1;$i>=0;$i--) { $dates[] = array( 'year' => date('Y', strtotime("first day of -$i months", $currentTime)), 'month' => date('m', strtotime("first day of -$i months", $currentTime)), 'monthName' => date('M', strtotime("first day of -$i months", $currentTime)) ); } 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/PYQeb
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     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 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 9
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 9
Branch analysis from position: 50
Branch analysis from position: 9
filename:       /in/PYQeb
function name:  _getRollingMonths
number of ops:  52
compiled vars:  !0 = $months, !1 = $currentTime, !2 = $dates, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      12
    3     1        INIT_FCALL                                               'strtotime'
          2        SEND_VAL                                                 '2015-03-01'
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    4     5        ASSIGN                                                   !2, <array>
    5     6        SUB                                              ~7      !0, 1
          7        ASSIGN                                                   !3, ~7
          8      > JMP                                                      ->48
    7     9    >   INIT_FCALL                                               'date'
         10        SEND_VAL                                                 'Y'
         11        INIT_FCALL                                               'strtotime'
         12        ROPE_INIT                                     3  ~11     'first+day+of+-'
         13        ROPE_ADD                                      1  ~11     ~11, !3
         14        ROPE_END                                      2  ~10     ~11, '+months'
         15        SEND_VAL                                                 ~10
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $13     
         18        SEND_VAR                                                 $13
         19        DO_ICALL                                         $14     
         20        INIT_ARRAY                                       ~15     $14, 'year'
    8    21        INIT_FCALL                                               'date'
         22        SEND_VAL                                                 'm'
         23        INIT_FCALL                                               'strtotime'
         24        ROPE_INIT                                     3  ~17     'first+day+of+-'
         25        ROPE_ADD                                      1  ~17     ~17, !3
         26        ROPE_END                                      2  ~16     ~17, '+months'
         27        SEND_VAL                                                 ~16
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $19     
         30        SEND_VAR                                                 $19
         31        DO_ICALL                                         $20     
         32        ADD_ARRAY_ELEMENT                                ~15     $20, 'month'
    9    33        INIT_FCALL                                               'date'
         34        SEND_VAL                                                 'M'
         35        INIT_FCALL                                               'strtotime'
         36        ROPE_INIT                                     3  ~22     'first+day+of+-'
         37        ROPE_ADD                                      1  ~22     ~22, !3
         38        ROPE_END                                      2  ~21     ~22, '+months'
         39        SEND_VAL                                                 ~21
         40        SEND_VAR                                                 !1
         41        DO_ICALL                                         $24     
         42        SEND_VAR                                                 $24
         43        DO_ICALL                                         $25     
         44        ADD_ARRAY_ELEMENT                                ~15     $25, 'monthName'
    6    45        ASSIGN_DIM                                               !2
    9    46        OP_DATA                                                  ~15
    5    47        PRE_DEC                                                  !3
         48    >   IS_SMALLER_OR_EQUAL                                      0, !3
         49      > JMPNZ                                                    ~27, ->9
   13    50    > > RETURN                                                   !2
   14    51*     > 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/PYQeb
function name:  debug
number of ops:  7
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ECHO                                                     '%3Cpre%3E'
   18     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   19     5        ECHO                                                     '%3C%2Fpre%3E'
   20     6      > RETURN                                                   null

End of function debug

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.28 ms | 1403 KiB | 21 Q