3v4l.org

run code in 300+ PHP versions simultaneously
<?php function monthToToday($past, $now, $format = 'Y-m') { $current = strtotime(date('Y-m-1', strtotime($past))); $result = array(); while($current < $now) { $result[] = date($format, $current); $current = strtotime('+1 month', $current); } //包含当前月份 $result[] = date($format, $current); return $result; } print_r(monthToToday('2013-12-25', time()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vuef4
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'monthtotoday'
          2        SEND_VAL                                                 '2013-12-25'
          3        INIT_FCALL                                               'time'
          4        DO_ICALL                                         $0      
          5        SEND_VAR                                                 $0
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function monthtotoday:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 16
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 16
Branch analysis from position: 29
Branch analysis from position: 16
filename:       /in/vuef4
function name:  monthToToday
number of ops:  37
compiled vars:  !0 = $past, !1 = $now, !2 = $format, !3 = $current, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      'Y-m'
    4     3        INIT_FCALL                                               'strtotime'
          4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'Y-m-1'
          6        INIT_FCALL                                               'strtotime'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                         $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                         $7      
         13        ASSIGN                                                   !3, $7
    5    14        ASSIGN                                                   !4, <array>
    6    15      > JMP                                                      ->27
    7    16    >   INIT_FCALL                                               'date'
         17        SEND_VAR                                                 !2
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $11     
         20        ASSIGN_DIM                                               !4
         21        OP_DATA                                                  $11
    8    22        INIT_FCALL                                               'strtotime'
         23        SEND_VAL                                                 '%2B1+month'
         24        SEND_VAR                                                 !3
         25        DO_ICALL                                         $12     
         26        ASSIGN                                                   !3, $12
    6    27    >   IS_SMALLER                                               !3, !1
         28      > JMPNZ                                                    ~14, ->16
   12    29    >   INIT_FCALL                                               'date'
         30        SEND_VAR                                                 !2
         31        SEND_VAR                                                 !3
         32        DO_ICALL                                         $16     
         33        ASSIGN_DIM                                               !4
         34        OP_DATA                                                  $16
   14    35      > RETURN                                                   !4
   15    36*     > RETURN                                                   null

End of function monthtotoday

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.66 ms | 1402 KiB | 22 Q