3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Check if a given date is the first Monday of the month * * @param \DateTime $date * @return bool */ function isFirstSundayOfMonth(DateTime $date) { return (int)$date->format('d') <= 7 && $date->format('l') === 'Sunday'; } $day = new DateTime(); var_dump(isFirstMondayayOfMonth($day));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GD436
function name:  (null)
number of ops:  10
compiled vars:  !0 = $day
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $1      'DateTime'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   13     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL_BY_NAME                                       'isFirstMondayayOfMonth'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function isfirstsundayofmonth:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/GD436
function name:  isFirstSundayOfMonth
number of ops:  14
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_METHOD_CALL                                         !0, 'format'
          2        SEND_VAL_EX                                              'd'
          3        DO_FCALL                                      0  $1      
          4        CAST                                          4  ~2      $1
          5        IS_SMALLER_OR_EQUAL                              ~3      ~2, 7
          6      > JMPZ_EX                                          ~3      ~3, ->12
          7    >   INIT_METHOD_CALL                                         !0, 'format'
          8        SEND_VAL_EX                                              'l'
          9        DO_FCALL                                      0  $4      
         10        IS_IDENTICAL                                     ~5      $4, 'Sunday'
         11        BOOL                                             ~3      ~5
         12    > > RETURN                                                   ~3
   10    13*     > RETURN                                                   null

End of function isfirstsundayofmonth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.99 ms | 1395 KiB | 15 Q