3v4l.org

run code in 300+ PHP versions simultaneously
<?php $duration = 2; $start='01-01-2019'; $month =date('n', strtotime($start)); $year =date('Y', strtotime($start)); $mon = 12-$month+1; $remainingMonth = $duration*12; $years_arr = array("$year"); $residue_arr = array("$remainingMonth"); $years_arr = process($remainingMonth,$year,$mon,$years_arr,$residue_arr); print_r($years_arr); //<output function process($remainingMonth,$year,$mon,$years_arr,$residue_arr){ $residue = $remainingMonth - $mon;//$D$18-D20 if($residue != 0){ $new_year = $year+1; array_push($years_arr, $new_year); array_push($residue_arr, $residue); if($residue > 12 ){ $mon = 12; } else { $mon = $residue; } echo "<br>"; process($residue,$new_year,$mon,$years_arr,$residue_arr); } else { print_r($years_arr); return $years_arr; } }//end of process(..)
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VC646
function name:  (null)
number of ops:  41
compiled vars:  !0 = $duration, !1 = $start, !2 = $month, !3 = $year, !4 = $mon, !5 = $remainingMonth, !6 = $years_arr, !7 = $residue_arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 2
    4     1        ASSIGN                                                   !1, '01-01-2019'
    5     2        INIT_FCALL                                               'date'
          3        SEND_VAL                                                 'n'
          4        INIT_FCALL                                               'strtotime'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $10     
          7        SEND_VAR                                                 $10
          8        DO_ICALL                                         $11     
          9        ASSIGN                                                   !2, $11
    6    10        INIT_FCALL                                               'date'
         11        SEND_VAL                                                 'Y'
         12        INIT_FCALL                                               'strtotime'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $13     
         15        SEND_VAR                                                 $13
         16        DO_ICALL                                         $14     
         17        ASSIGN                                                   !3, $14
    7    18        SUB                                              ~16     12, !2
         19        ADD                                              ~17     ~16, 1
         20        ASSIGN                                                   !4, ~17
    8    21        MUL                                              ~19     !0, 12
         22        ASSIGN                                                   !5, ~19
   10    23        CAST                                          6  ~21     !3
         24        INIT_ARRAY                                       ~22     ~21
         25        ASSIGN                                                   !6, ~22
   11    26        CAST                                          6  ~24     !5
         27        INIT_ARRAY                                       ~25     ~24
         28        ASSIGN                                                   !7, ~25
   12    29        INIT_FCALL_BY_NAME                                       'process'
         30        SEND_VAR_EX                                              !5
         31        SEND_VAR_EX                                              !3
         32        SEND_VAR_EX                                              !4
         33        SEND_VAR_EX                                              !6
         34        SEND_VAR_EX                                              !7
         35        DO_FCALL                                      0  $27     
         36        ASSIGN                                                   !6, $27
   14    37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !6
         39        DO_ICALL                                                 
   34    40      > RETURN                                                   1

Function process:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 33
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VC646
function name:  process
number of ops:  38
compiled vars:  !0 = $remainingMonth, !1 = $year, !2 = $mon, !3 = $years_arr, !4 = $residue_arr, !5 = $residue, !6 = $new_year
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
   17     5        SUB                                              ~7      !0, !2
          6        ASSIGN                                                   !5, ~7
   18     7        IS_NOT_EQUAL                                             !5, 0
          8      > JMPZ                                                     ~9, ->33
   19     9    >   ADD                                              ~10     !1, 1
         10        ASSIGN                                                   !6, ~10
   20    11        INIT_FCALL                                               'array_push'
         12        SEND_REF                                                 !3
         13        SEND_VAR                                                 !6
         14        DO_ICALL                                                 
   21    15        INIT_FCALL                                               'array_push'
         16        SEND_REF                                                 !4
         17        SEND_VAR                                                 !5
         18        DO_ICALL                                                 
   23    19        IS_SMALLER                                               12, !5
         20      > JMPZ                                                     ~14, ->23
   24    21    >   ASSIGN                                                   !2, 12
         22      > JMP                                                      ->24
   26    23    >   ASSIGN                                                   !2, !5
   28    24    >   ECHO                                                     '%3Cbr%3E'
   29    25        INIT_FCALL_BY_NAME                                       'process'
         26        SEND_VAR_EX                                              !5
         27        SEND_VAR_EX                                              !6
         28        SEND_VAR_EX                                              !2
         29        SEND_VAR_EX                                              !3
         30        SEND_VAR_EX                                              !4
         31        DO_FCALL                                      0          
         32      > JMP                                                      ->37
   31    33    >   INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !3
         35        DO_ICALL                                                 
   32    36      > RETURN                                                   !3
   34    37    > > RETURN                                                   null

End of function process

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.65 ms | 1405 KiB | 21 Q