3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strtDate = '2015-05-01'; $endDate = '2015-08-31'; $begin = new DateTime($strtDate); $end = new DateTime(date("Y-m-d", strtotime("+1 day", strtotime($endDate)))); // $weekNo = floor($begin->diff($end)->days / 7); $startDateWeekCnt = floor( date('d',strtotime($begin)) / 7) ; // echo $startDateWeekCnt ."\n"; $endDateWeekCnt = floor( date('d',strtotime($end)) / 7) ; //echo $endDateWeekCnt. "\n"; $datediff = strtotime(date('Y-m',strtotime($endDate))."-01") - strtotime(date('Y-m',strtotime($strtDate))."-01"); $totalnoOfWeek = round(floor($datediff/(60*60*24)) / 7) + $endDateWeekCnt - $startDateWeekCnt ; echo $totalnoOfWeek ."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/phhdV
function name:  (null)
number of ops:  83
compiled vars:  !0 = $strtDate, !1 = $endDate, !2 = $begin, !3 = $end, !4 = $startDateWeekCnt, !5 = $endDateWeekCnt, !6 = $datediff, !7 = $totalnoOfWeek
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '2015-05-01'
    3     1        ASSIGN                                                   !1, '2015-08-31'
    5     2        NEW                                              $10     'DateTime'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $10
    6     6        NEW                                              $13     'DateTime'
          7        INIT_FCALL                                               'date'
          8        SEND_VAL                                                 'Y-m-d'
          9        INIT_FCALL                                               'strtotime'
         10        SEND_VAL                                                 '%2B1+day'
         11        INIT_FCALL                                               'strtotime'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $14     
         14        SEND_VAR                                                 $14
         15        DO_ICALL                                         $15     
         16        SEND_VAR                                                 $15
         17        DO_ICALL                                         $16     
         18        SEND_VAR_NO_REF_EX                                       $16
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !3, $13
    8    21        INIT_FCALL                                               'floor'
         22        INIT_FCALL                                               'date'
         23        SEND_VAL                                                 'd'
         24        INIT_FCALL                                               'strtotime'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $19     
         27        SEND_VAR                                                 $19
         28        DO_ICALL                                         $20     
         29        DIV                                              ~21     $20, 7
         30        SEND_VAL                                                 ~21
         31        DO_ICALL                                         $22     
         32        ASSIGN                                                   !4, $22
   10    33        INIT_FCALL                                               'floor'
         34        INIT_FCALL                                               'date'
         35        SEND_VAL                                                 'd'
         36        INIT_FCALL                                               'strtotime'
         37        SEND_VAR                                                 !3
         38        DO_ICALL                                         $24     
         39        SEND_VAR                                                 $24
         40        DO_ICALL                                         $25     
         41        DIV                                              ~26     $25, 7
         42        SEND_VAL                                                 ~26
         43        DO_ICALL                                         $27     
         44        ASSIGN                                                   !5, $27
   13    45        INIT_FCALL                                               'strtotime'
         46        INIT_FCALL                                               'date'
         47        SEND_VAL                                                 'Y-m'
         48        INIT_FCALL                                               'strtotime'
         49        SEND_VAR                                                 !1
         50        DO_ICALL                                         $29     
         51        SEND_VAR                                                 $29
         52        DO_ICALL                                         $30     
         53        CONCAT                                           ~31     $30, '-01'
         54        SEND_VAL                                                 ~31
         55        DO_ICALL                                         $32     
         56        INIT_FCALL                                               'strtotime'
         57        INIT_FCALL                                               'date'
         58        SEND_VAL                                                 'Y-m'
         59        INIT_FCALL                                               'strtotime'
         60        SEND_VAR                                                 !0
         61        DO_ICALL                                         $33     
         62        SEND_VAR                                                 $33
         63        DO_ICALL                                         $34     
         64        CONCAT                                           ~35     $34, '-01'
         65        SEND_VAL                                                 ~35
         66        DO_ICALL                                         $36     
         67        SUB                                              ~37     $32, $36
         68        ASSIGN                                                   !6, ~37
   14    69        INIT_FCALL                                               'round'
         70        INIT_FCALL                                               'floor'
         71        DIV                                              ~39     !6, 86400
         72        SEND_VAL                                                 ~39
         73        DO_ICALL                                         $40     
         74        DIV                                              ~41     $40, 7
         75        SEND_VAL                                                 ~41
         76        DO_ICALL                                         $42     
         77        ADD                                              ~43     $42, !5
         78        SUB                                              ~44     ~43, !4
         79        ASSIGN                                                   !7, ~44
   15    80        CONCAT                                           ~46     !7, '%0A'
         81        ECHO                                                     ~46
         82      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
194.11 ms | 1400 KiB | 21 Q