3v4l.org

run code in 300+ PHP versions simultaneously
<?php $receipt_date = new DateTime('2016-05-19'); $date = new DateTime('2016-05-23'); $difference = $receipt_date->diff($date); $daterange = new DatePeriod($receipt_date, new DateInterval('P1D'), $date); $count = 0; foreach($daterange as $date){ if(!($date->format("w"))) { $count++; } } echo ($difference->days)-$count;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 31
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 31
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 30
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 30
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/qb0DJ
function name:  (null)
number of ops:  36
compiled vars:  !0 = $receipt_date, !1 = $date, !2 = $difference, !3 = $daterange, !4 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $5      'DateTime'
          1        SEND_VAL_EX                                              '2016-05-19'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $5
    3     4        NEW                                              $8      'DateTime'
          5        SEND_VAL_EX                                              '2016-05-23'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $8
    4     8        INIT_METHOD_CALL                                         !0, 'diff'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $11     
         11        ASSIGN                                                   !2, $11
    6    12        NEW                                              $13     'DatePeriod'
         13        SEND_VAR_EX                                              !0
         14        NEW                                              $14     'DateInterval'
         15        SEND_VAL_EX                                              'P1D'
         16        DO_FCALL                                      0          
         17        SEND_VAR_NO_REF_EX                                       $14
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !3, $13
    8    21        ASSIGN                                                   !4, 0
   10    22      > FE_RESET_R                                       $19     !3, ->31
         23    > > FE_FETCH_R                                               $19, !1, ->31
   11    24    >   INIT_METHOD_CALL                                         !1, 'format'
         25        SEND_VAL_EX                                              'w'
         26        DO_FCALL                                      0  $20     
         27        BOOL_NOT                                         ~21     $20
         28      > JMPZ                                                     ~21, ->30
   12    29    >   PRE_INC                                                  !4
   10    30    > > JMP                                                      ->23
         31    >   FE_FREE                                                  $19
   16    32        FETCH_OBJ_R                                      ~23     !2, 'days'
         33        SUB                                              ~24     ~23, !4
         34        ECHO                                                     ~24
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.77 ms | 1399 KiB | 13 Q