3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = "2018-05-07"; $end = "2019-07-04"; $times = 0; // Check if first and last month in the range has a 14th. If(date("d", strtotime($start)) <= 14) $times++; If(date("d", strtotime($end)) >= 14) $times++; // Create an array with months between start and end $months = range(strtotime($start . "+1 month"), strtotime($end . "-1 month"), 86400*30); Var_dump($months); // Add the count of the months $times += count($months); Echo $times;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 13
filename:       /in/RevLg
function name:  (null)
number of ops:  44
compiled vars:  !0 = $start, !1 = $end, !2 = $times, !3 = $months
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2018-05-07'
    4     1        ASSIGN                                                   !1, '2019-07-04'
    6     2        ASSIGN                                                   !2, 0
    9     3        INIT_FCALL                                               'date'
          4        SEND_VAL                                                 'd'
          5        INIT_FCALL                                               'strtotime'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $7      
          8        SEND_VAR                                                 $7
          9        DO_ICALL                                         $8      
         10        IS_SMALLER_OR_EQUAL                                      $8, 14
         11      > JMPZ                                                     ~9, ->13
         12    >   PRE_INC                                                  !2
   10    13    >   INIT_FCALL                                               'date'
         14        SEND_VAL                                                 'd'
         15        INIT_FCALL                                               'strtotime'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $11     
         18        SEND_VAR                                                 $11
         19        DO_ICALL                                         $12     
         20        IS_SMALLER_OR_EQUAL                                      14, $12
         21      > JMPZ                                                     ~13, ->23
         22    >   PRE_INC                                                  !2
   13    23    >   INIT_FCALL                                               'range'
         24        INIT_FCALL                                               'strtotime'
         25        CONCAT                                           ~15     !0, '%2B1+month'
         26        SEND_VAL                                                 ~15
         27        DO_ICALL                                         $16     
         28        SEND_VAR                                                 $16
         29        INIT_FCALL                                               'strtotime'
         30        CONCAT                                           ~17     !1, '-1+month'
         31        SEND_VAL                                                 ~17
         32        DO_ICALL                                         $18     
         33        SEND_VAR                                                 $18
         34        SEND_VAL                                                 2592000
         35        DO_ICALL                                         $19     
         36        ASSIGN                                                   !3, $19
   14    37        INIT_FCALL                                               'var_dump'
         38        SEND_VAR                                                 !3
         39        DO_ICALL                                                 
   16    40        COUNT                                            ~22     !3
         41        ASSIGN_OP                                     1          !2, ~22
   18    42        ECHO                                                     !2
   19    43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.53 ms | 1018 KiB | 17 Q