3v4l.org

run code in 300+ PHP versions simultaneously
<?php function countDaysByName($dayName, \DateTime $start, \DateTime $end) { $count = 0; $interval = new \DateInterval('P1D'); $period = new \DatePeriod($start, $interval, $end); foreach($period as $day){ if($day->format('D') === ucfirst(substr($dayName, 0, 3))){ $count ++; } } return $count; } echo countDaysByName('wednesday', new \DateTime(2016-01-18), new \DateTime(2016-01-23)); echo var_dump(new \DateTime(2016-18-01));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qe70Y
function name:  (null)
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'countdaysbyname'
          1        SEND_VAL                                                 'wednesday'
          2        NEW                                              $0      'DateTime'
          3        SEND_VAL_EX                                              1997
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $0
          6        NEW                                              $2      'DateTime'
          7        SEND_VAL_EX                                              1992
          8        DO_FCALL                                      0          
          9        SEND_VAR                                                 $2
         10        DO_FCALL                                      0  $4      
         11        ECHO                                                     $4
   19    12        INIT_FCALL                                               'var_dump'
         13        NEW                                              $5      'DateTime'
         14        SEND_VAL_EX                                              1997
         15        DO_FCALL                                      0          
         16        SEND_VAR                                                 $5
         17        DO_ICALL                                         $7      
         18        ECHO                                                     $7
         19      > RETURN                                                   1

Function countdaysbyname:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 31
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 31
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 30
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
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/qe70Y
function name:  countDaysByName
number of ops:  34
compiled vars:  !0 = $dayName, !1 = $start, !2 = $end, !3 = $count, !4 = $interval, !5 = $period, !6 = $day
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    5     3        ASSIGN                                                   !3, 0
    6     4        NEW                                              $8      'DateInterval'
          5        SEND_VAL_EX                                              'P1D'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !4, $8
    7     8        NEW                                              $11     'DatePeriod'
          9        SEND_VAR_EX                                              !1
         10        SEND_VAR_EX                                              !4
         11        SEND_VAR_EX                                              !2
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !5, $11
    9    14      > FE_RESET_R                                       $14     !5, ->31
         15    > > FE_FETCH_R                                               $14, !6, ->31
   10    16    >   INIT_METHOD_CALL                                         !6, 'format'
         17        SEND_VAL_EX                                              'D'
         18        DO_FCALL                                      0  $15     
         19        INIT_FCALL                                               'ucfirst'
         20        INIT_FCALL                                               'substr'
         21        SEND_VAR                                                 !0
         22        SEND_VAL                                                 0
         23        SEND_VAL                                                 3
         24        DO_ICALL                                         $16     
         25        SEND_VAR                                                 $16
         26        DO_ICALL                                         $17     
         27        IS_IDENTICAL                                             $15, $17
         28      > JMPZ                                                     ~18, ->30
   11    29    >   PRE_INC                                                  !3
    9    30    > > JMP                                                      ->15
         31    >   FE_FREE                                                  $14
   14    32      > RETURN                                                   !3
   15    33*     > RETURN                                                   null

End of function countdaysbyname

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.76 ms | 1403 KiB | 20 Q