3v4l.org

run code in 500+ PHP versions simultaneously
<?php if (!function_exists('easter_date')) { /** * @see https://github.com/steinger/easter-date/blob/master/easter.php * @return int unix timestamp of the day of easter */ function easter_date(int $year): int { $J = date('Y', mktime(0, 0, 0, 1, 1, $year)); $K = floor( $J/ 100 ); $M = 15 + floor(( 3*$K+3 ) / 4 ) - floor(( 8*$K+13 ) / 25 ); $S = 2 - floor(( 3*$K+3 ) / 4 ); $A = $J%19; $D = ( 19 * $A + $M) % 30; $R = floor( $D / 29 ) + ( floor( $D / 28 ) - floor( $D / 29 )) * floor( $A / 11 ); $OG = 21 + $D - $R; $SZ = 7 - ( ($J + floor( $J / 4 ) + $S ) % 7 ); $OE = 7 - ( ($OG - $SZ) % 7 ); $OS = $OG + $OE; return mktime(0,0,0,3,$OS,$J); } } //observed closures $closures = [ '2017' => [ '2017-08-28', '2017-08-29', '2017-08-30', '2017-08-31', '2017-09-01' ] ]; file_put_contents(Holiday::CLOSURES_FILE, '<?php return ' . var_export($closures, true) . ';'); class Holiday { public const CLOSURES_FILE = '/tmp/closures.php'; private static $closuresLoaded = false; /** * date format = N (1 = Monday, ...) * @var array */ private static $workingDays = [1, 2, 3, 4, 5]; private static $observableHolidays = []; /** * Is submitted date a holiday? * * @param DateTime $date * @return bool */ public static function isHoliday(\DateTimeInterface $date): bool { $holidays = self::getHolidays($date); return \array_key_exists($date->format('Y-m-d'), \array_flip($holidays[$date->format('Y')])); } public static function isWorkDay(\DateTimeInterface $date): bool { if (!\in_array($date->format('N'), self::$workingDays)) { return false; } if (self::isHoliday($date)) { return false; } return true; } /** * Count number of weekdays within a given date span, excluding holidays * * @param \DateTimeInterface $from * @param \DateTimeInterface $to * @return int * @throws Exception */ public static function countWeekDays(\DateTimeInterface $from, \DateTimeInterface $to = null) { if (is_null($to)) { return null; } // from stackoverflow: // http://stackoverflow.com/questions/336127/calculate-business-days#19221403 $from = clone $from; $from->setTime(0, 0, 0); $to = clone $to; $to->setTime(0, 0, 0); $interval = new DateInterval('P1D'); $to->add($interval); $period = new DatePeriod($from, $interval, $to); $days = 0; /** @var DateTime $date */ foreach ($period as $date) { if (self::isWorkDay($date)) { $days++; } } return $days; } /** * Return count of weekdays in given month * * @param int $month * @param int $year * @return int * @throws Exception */ public static function countWeekDaysInMonthToDate(int $month, int $year): int { $today = new \DateTimeImmutable(); $d1 = $today->setDate($year, $month, 1); $d2 = $d1->modify('last day of this month'); return self::countWeekDays($d1, min($d2, $today)); } /** * @see https://www.php.net/manual/en/function.easter-date.php * @param \DateTimeInterface $date * @return \DateTimeImmutable */ private static function getEaster(\DateTimeInterface $date): \DateTimeImmutable { return (new \DateTimeImmutable())->setTimestamp(\easter_date($date->format('Y'))); } /** * Returns an array of strings representing holidays in format 'Y-m-d' * * @return array|string[][] */ public static function getHolidays(\DateTimeInterface $start): array { static $relativeHolidays = [ 'new years day' => 'first day of January', 'easter' => [__CLASS__, 'getEaster'], 'memorial day' => 'second Monday of May', 'independence day' => 'July 4th', 'labor day' => 'first Monday of September', 'thanksgiving' => 'fourth Thursday of November', 'black friday' => 'fourth Thursday of November + 1 day', 'christmas' => 'December 25th', 'new years eve' => 'last day of December', //... add others like Veterans Day, MLK, Columbus Day, etc ]; if (!$start instanceof \DateTimeImmutable) { //force using DateTimeImmutable $start = \DateTimeImmutable::createFromMutable($start); } //build the holidays to the specified year $start = $start->modify('first day of this year'); //always generate an entire years worth of holidays $period = new \DatePeriod($start, new \DateInterval('P1Y'), 0); foreach ($period as $date) { $year = $date->format('Y'); if (array_key_exists($year, self::$observableHolidays)) { continue; } self::$observableHolidays[$year] = []; foreach ($relativeHolidays as $relativeHoliday) { if (\is_callable($relativeHoliday)) { $holidayDate = $relativeHoliday($date); } elseif (0 === \strpos($relativeHoliday, 'P')) { $holidayDate = $date->add(new \DateInterval($relativeHoliday)); } else { $holidayDate = $date->modify($relativeHoliday); } self::$observableHolidays[$year][] = $holidayDate->format('Y-m-d'); } } //optionally do not use include file //return self::$observableHolidays; $holidays = self::$observableHolidays; if (\is_file(self::CLOSURES_FILE)) { foreach (include self::CLOSURES_FILE as $year => $dates) { if (!\array_key_exists($year, $holidays)) { $holidays[$year] = []; } $holidays[$year] = \array_merge($holidays[$year], $dates); } } return $holidays; } } $date = new \DateTime('2017-08-28'); $holidays = Holiday::getHolidays($date); var_export($holidays); echo \PHP_EOL; var_dump(Holiday::isHoliday($date));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/fnj67
function name:  (null)
number of ops:  37
compiled vars:  !0 = $closures, !1 = $date, !2 = $holidays
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                                   'function_exists'
          1        SEND_VAL                                                     'easter_date'
          2        DO_ICALL                                             $3      
          3        BOOL_NOT                                             ~4      $3
          4      > JMPZ                                                         ~4, ->6
    9     5    >   DECLARE_FUNCTION                                             'easter_date'
   28     6    >   ASSIGN                                                       !0, <array>
   37     7        INIT_FCALL                                                   'file_put_contents'
          8        FETCH_CLASS_CONSTANT                                 ~6      'Holiday', 'CLOSURES_FILE'
          9        SEND_VAL                                                     ~6
         10        INIT_FCALL                                                   'var_export'
         11        SEND_VAR                                                     !0
         12        SEND_VAL                                                     <true>
         13        DO_ICALL                                             $7      
         14        CONCAT                                               ~8      '%3C%3Fphp+return+', $7
         15        CONCAT                                               ~9      ~8, '%3B'
         16        SEND_VAL                                                     ~9
         17        DO_ICALL                                                     
  206    18        NEW                                                  $11     'DateTime'
         19        SEND_VAL_EX                                                  '2017-08-28'
         20        DO_FCALL                                          0          
         21        ASSIGN                                                       !1, $11
  207    22        INIT_STATIC_METHOD_CALL                                      'Holiday', 'getHolidays'
         23        SEND_VAR                                                     !1
         24        DO_FCALL                                          0  $14     
         25        ASSIGN                                                       !2, $14
  208    26        INIT_FCALL                                                   'var_export'
         27        SEND_VAR                                                     !2
         28        DO_ICALL                                                     
  209    29        ECHO                                                         '%0A'
  210    30        INIT_FCALL                                                   'var_dump'
         31        INIT_STATIC_METHOD_CALL                                      'Holiday', 'isHoliday'
         32        SEND_VAR                                                     !1
         33        DO_FCALL                                          0  $17     
         34        SEND_VAR                                                     $17
         35        DO_ICALL                                                     
         36      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fnj67
function name:  easter_date
number of ops:  98
compiled vars:  !0 = $year, !1 = $J, !2 = $K, !3 = $M, !4 = $S, !5 = $A, !6 = $D, !7 = $R, !8 = $OG, !9 = $SZ, !10 = $OE, !11 = $OS
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   10     1        INIT_FCALL                                                   'date'
          2        SEND_VAL                                                     'Y'
          3        INIT_FCALL                                                   'mktime'
          4        SEND_VAL                                                     0
          5        SEND_VAL                                                     0
          6        SEND_VAL                                                     0
          7        SEND_VAL                                                     1
          8        SEND_VAL                                                     1
          9        SEND_VAR                                                     !0
         10        DO_ICALL                                             $12     
         11        SEND_VAR                                                     $12
         12        DO_ICALL                                             $13     
         13        ASSIGN                                                       !1, $13
   11    14        INIT_FCALL                                                   'floor'
         15        DIV                                                  ~15     !1, 100
         16        SEND_VAL                                                     ~15
         17        DO_ICALL                                             $16     
         18        ASSIGN                                                       !2, $16
   12    19        INIT_FCALL                                                   'floor'
         20        MUL                                                  ~18     !2, 3
         21        ADD                                                  ~19     ~18, 3
         22        DIV                                                  ~20     ~19, 4
         23        SEND_VAL                                                     ~20
         24        DO_ICALL                                             $21     
         25        ADD                                                  ~22     15, $21
         26        INIT_FCALL                                                   'floor'
         27        MUL                                                  ~23     !2, 8
         28        ADD                                                  ~24     ~23, 13
         29        DIV                                                  ~25     ~24, 25
         30        SEND_VAL                                                     ~25
         31        DO_ICALL                                             $26     
         32        SUB                                                  ~27     ~22, $26
         33        ASSIGN                                                       !3, ~27
   13    34        INIT_FCALL                                                   'floor'
         35        MUL                                                  ~29     !2, 3
         36        ADD                                                  ~30     ~29, 3
         37        DIV                                                  ~31     ~30, 4
         38        SEND_VAL                                                     ~31
         39        DO_ICALL                                             $32     
         40        SUB                                                  ~33     2, $32
         41        ASSIGN                                                       !4, ~33
   14    42        MOD                                                  ~35     !1, 19
         43        ASSIGN                                                       !5, ~35
   15    44        MUL                                                  ~37     !5, 19
         45        ADD                                                  ~38     ~37, !3
         46        MOD                                                  ~39     ~38, 30
         47        ASSIGN                                                       !6, ~39
   16    48        INIT_FCALL                                                   'floor'
         49        DIV                                                  ~41     !6, 29
         50        SEND_VAL                                                     ~41
         51        DO_ICALL                                             $42     
         52        INIT_FCALL                                                   'floor'
         53        DIV                                                  ~43     !6, 28
         54        SEND_VAL                                                     ~43
         55        DO_ICALL                                             $44     
         56        INIT_FCALL                                                   'floor'
         57        DIV                                                  ~45     !6, 29
         58        SEND_VAL                                                     ~45
         59        DO_ICALL                                             $46     
         60        SUB                                                  ~47     $44, $46
         61        INIT_FCALL                                                   'floor'
         62        DIV                                                  ~48     !5, 11
         63        SEND_VAL                                                     ~48
         64        DO_ICALL                                             $49     
         65        MUL                                                  ~50     $49, ~47
         66        ADD                                                  ~51     $42, ~50
         67        ASSIGN                                                       !7, ~51
   17    68        ADD                                                  ~53     21, !6
         69        SUB                                                  ~54     ~53, !7
         70        ASSIGN                                                       !8, ~54
   18    71        INIT_FCALL                                                   'floor'
         72        DIV                                                  ~56     !1, 4
         73        SEND_VAL                                                     ~56
         74        DO_ICALL                                             $57     
         75        ADD                                                  ~58     !1, $57
         76        ADD                                                  ~59     ~58, !4
         77        MOD                                                  ~60     ~59, 7
         78        SUB                                                  ~61     7, ~60
         79        ASSIGN                                                       !9, ~61
   19    80        SUB                                                  ~63     !8, !9
         81        MOD                                                  ~64     ~63, 7
         82        SUB                                                  ~65     7, ~64
         83        ASSIGN                                                       !10, ~65
   20    84        ADD                                                  ~67     !8, !10
         85        ASSIGN                                                       !11, ~67
   22    86        INIT_FCALL                                                   'mktime'
         87        SEND_VAL                                                     0
         88        SEND_VAL                                                     0
         89        SEND_VAL                                                     0
         90        SEND_VAL                                                     3
         91        SEND_VAR                                                     !11
         92        SEND_VAR                                                     !1
         93        DO_ICALL                                             $69     
         94        VERIFY_RETURN_TYPE                                           $69
         95      > RETURN                                                       $69
   23    96*       VERIFY_RETURN_TYPE                                           
         97*     > RETURN                                                       null

End of Dynamic Function 0

Class Holiday:
Function isholiday:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fnj67
function name:  isHoliday
number of ops:  20
compiled vars:  !0 = $date, !1 = $holidays
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   60     0  E >   RECV                                                 !0      
   62     1        INIT_STATIC_METHOD_CALL                                      'getHolidays'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0  $2      
          4        ASSIGN                                                       !1, $2
   64     5        INIT_METHOD_CALL                                             !0, 'format'
          6        SEND_VAL_EX                                                  'Y-m-d'
          7        DO_FCALL                                          0  $4      
          8        INIT_FCALL                                                   'array_flip'
          9        INIT_METHOD_CALL                                             !0, 'format'
         10        SEND_VAL_EX                                                  'Y'
         11        DO_FCALL                                          0  $5      
         12        FETCH_DIM_R                                          ~6      !1, $5
         13        SEND_VAL                                                     ~6
         14        DO_ICALL                                             $7      
         15        ARRAY_KEY_EXISTS                                     ~8      $4, $7
         16        VERIFY_RETURN_TYPE                                           ~8
         17      > RETURN                                                       ~8
   65    18*       VERIFY_RETURN_TYPE                                           
         19*     > RETURN                                                       null

End of function isholiday

Function isworkday:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fnj67
function name:  isWorkDay
number of ops:  17
compiled vars:  !0 = $date
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   67     0  E >   RECV                                                 !0      
   69     1        INIT_METHOD_CALL                                             !0, 'format'
          2        SEND_VAL_EX                                                  'N'
          3        DO_FCALL                                          0  $1      
          4        FETCH_STATIC_PROP_R              unknown             ~2      'workingDays'
          5        FRAMELESS_ICALL_2                in_array            ~3      $1, ~2
          6        BOOL_NOT                                             ~4      ~3
          7      > JMPZ                                                         ~4, ->9
   70     8    > > RETURN                                                       <false>
   72     9    >   INIT_STATIC_METHOD_CALL                                      'isHoliday'
         10        SEND_VAR                                                     !0
         11        DO_FCALL                                          0  $5      
         12      > JMPZ                                                         $5, ->14
   73    13    > > RETURN                                                       <false>
   76    14    > > RETURN                                                       <true>
   77    15*       VERIFY_RETURN_TYPE                                           
         16*     > RETURN                                                       null

End of function isworkday

Function countweekdays:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 34, Position 2 = 41
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 41
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 40
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 40
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/fnj67
function name:  countWeekDays
number of ops:  44
compiled vars:  !0 = $from, !1 = $to, !2 = $interval, !3 = $period, !4 = $days, !5 = $date
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   87     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      null
   89     2        TYPE_CHECK                                        2          !1
          3      > JMPZ                                                         ~6, ->5
   90     4    > > RETURN                                                       null
   96     5    >   CLONE                                                ~7      !0
          6        ASSIGN                                                       !0, ~7
   97     7        INIT_METHOD_CALL                                             !0, 'setTime'
          8        SEND_VAL_EX                                                  0
          9        SEND_VAL_EX                                                  0
         10        SEND_VAL_EX                                                  0
         11        DO_FCALL                                          0          
   98    12        CLONE                                                ~10     !1
         13        ASSIGN                                                       !1, ~10
   99    14        INIT_METHOD_CALL                                             !1, 'setTime'
         15        SEND_VAL_EX                                                  0
         16        SEND_VAL_EX                                                  0
         17        SEND_VAL_EX                                                  0
         18        DO_FCALL                                          0          
  100    19        NEW                                                  $13     'DateInterval'
         20        SEND_VAL_EX                                                  'P1D'
         21        DO_FCALL                                          0          
         22        ASSIGN                                                       !2, $13
  101    23        INIT_METHOD_CALL                                             !1, 'add'
         24        SEND_VAR_EX                                                  !2
         25        DO_FCALL                                          0          
  102    26        NEW                                                  $17     'DatePeriod'
         27        SEND_VAR_EX                                                  !0
         28        SEND_VAR_EX                                                  !2
         29        SEND_VAR_EX                                                  !1
         30        DO_FCALL                                          0          
         31        ASSIGN                                                       !3, $17
  104    32        ASSIGN                                                       !4, 0
  106    33      > FE_RESET_R                                           $21     !3, ->41
         34    > > FE_FETCH_R                                                   $21, !5, ->41
  107    35    >   INIT_STATIC_METHOD_CALL                                      'isWorkDay'
         36        SEND_VAR                                                     !5
         37        DO_FCALL                                          0  $22     
         38      > JMPZ                                                         $22, ->40
  108    39    >   PRE_INC                                                      !4
  106    40    > > JMP                                                          ->34
         41    >   FE_FREE                                                      $21
  112    42      > RETURN                                                       !4
  113    43*     > RETURN                                                       null

End of function countweekdays

Function countweekdaysinmonthtodate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fnj67
function name:  countWeekDaysInMonthToDate
number of ops:  24
compiled vars:  !0 = $month, !1 = $year, !2 = $today, !3 = $d1, !4 = $d2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  123     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
  125     2        NEW                                                  $5      'DateTimeImmutable'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !2, $5
  126     5        INIT_METHOD_CALL                                             !2, 'setDate'
          6        SEND_VAR_EX                                                  !1
          7        SEND_VAR_EX                                                  !0
          8        SEND_VAL_EX                                                  1
          9        DO_FCALL                                          0  $8      
         10        ASSIGN                                                       !3, $8
  127    11        INIT_METHOD_CALL                                             !3, 'modify'
         12        SEND_VAL_EX                                                  'last+day+of+this+month'
         13        DO_FCALL                                          0  $10     
         14        ASSIGN                                                       !4, $10
  129    15        INIT_STATIC_METHOD_CALL                                      'countWeekDays'
         16        SEND_VAR                                                     !3
         17        FRAMELESS_ICALL_2                min                 ~12     !4, !2
         18        SEND_VAL                                                     ~12
         19        DO_FCALL                                          0  $13     
         20        VERIFY_RETURN_TYPE                                           $13
         21      > RETURN                                                       $13
  130    22*       VERIFY_RETURN_TYPE                                           
         23*     > RETURN                                                       null

End of function countweekdaysinmonthtodate

Function geteaster:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fnj67
function name:  getEaster
number of ops:  16
compiled vars:  !0 = $date
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  137     0  E >   RECV                                                 !0      
  139     1        NEW                                                  $1      'DateTimeImmutable'
          2        DO_FCALL                                          0          
          3        INIT_METHOD_CALL                                             $1, 'setTimestamp'
          4        INIT_FCALL_BY_NAME                                           'easter_date'
          5        INIT_METHOD_CALL                                             !0, 'format'
          6        SEND_VAL_EX                                                  'Y'
          7        DO_FCALL                                          0  $3      
          8        SEND_VAR_NO_REF_EX                                           $3
          9        DO_FCALL                                          0  $4      
         10        SEND_VAR_NO_REF_EX                                           $4
         11        DO_FCALL                                          0  $5      
         12        VERIFY_RETURN_TYPE                                           $5
         13      > RETURN                                                       $5
  140    14*       VERIFY_RETURN_TYPE                                           
         15*     > RETURN                                                       null

End of function geteaster

Function getholidays:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 71
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 71
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 32
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 32
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 69
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 69
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 46
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 57
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 69
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 96
Branch analysis from position: 78
2 jumps found. (Code = 77) Position 1 = 80, Position 2 = 95
Branch analysis from position: 80
2 jumps found. (Code = 78) Position 1 = 81, Position 2 = 95
Branch analysis from position: 81
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 87
Branch analysis from position: 85
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
Branch analysis from position: 87
Branch analysis from position: 95
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 95
Branch analysis from position: 96
Branch analysis from position: 71
Branch analysis from position: 9
filename:       /in/fnj67
function name:  getHolidays
number of ops:  100
compiled vars:  !0 = $start, !1 = $relativeHolidays, !2 = $period, !3 = $date, !4 = $year, !5 = $relativeHoliday, !6 = $holidayDate, !7 = $holidays, !8 = $dates
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  147     0  E >   RECV                                                 !0      
  149     1        BIND_STATIC                                                  !1
  163     2        INSTANCEOF                                           ~9      !0, 'DateTimeImmutable'
          3        BOOL_NOT                                             ~10     ~9
          4      > JMPZ                                                         ~10, ->9
  165     5    >   INIT_STATIC_METHOD_CALL                                      'DateTimeImmutable', 'createFromMutable'
          6        SEND_VAR                                                     !0
          7        DO_FCALL                                          0  $11     
          8        ASSIGN                                                       !0, $11
  168     9    >   INIT_METHOD_CALL                                             !0, 'modify'
         10        SEND_VAL_EX                                                  'first+day+of+this+year'
         11        DO_FCALL                                          0  $13     
         12        ASSIGN                                                       !0, $13
  171    13        NEW                                                  $15     'DatePeriod'
         14        SEND_VAR_EX                                                  !0
         15        NEW                                                  $16     'DateInterval'
         16        SEND_VAL_EX                                                  'P1Y'
         17        DO_FCALL                                          0          
         18        SEND_VAR_NO_REF_EX                                           $16
         19        SEND_VAL_EX                                                  0
         20        DO_FCALL                                          0          
         21        ASSIGN                                                       !2, $15
  172    22      > FE_RESET_R                                           $20     !2, ->71
         23    > > FE_FETCH_R                                                   $20, !3, ->71
  173    24    >   INIT_METHOD_CALL                                             !3, 'format'
         25        SEND_VAL_EX                                                  'Y'
         26        DO_FCALL                                          0  $21     
         27        ASSIGN                                                       !4, $21
  174    28        FETCH_STATIC_PROP_R              unknown             ~23     'observableHolidays'
         29        ARRAY_KEY_EXISTS                                             !4, ~23
         30      > JMPZ                                                         ~24, ->32
  175    31    > > JMP                                                          ->23
  177    32    >   FETCH_STATIC_PROP_W              unknown             $25     'observableHolidays'
         33        ASSIGN_DIM                                                   $25, !4
         34        OP_DATA                                                      <array>
  178    35      > FE_RESET_R                                           $27     !1, ->69
         36    > > FE_FETCH_R                                                   $27, !5, ->69
  179    37    >   INIT_FCALL                                                   'is_callable'
         38        SEND_VAR                                                     !5
         39        DO_ICALL                                             $28     
         40      > JMPZ                                                         $28, ->46
  180    41    >   INIT_DYNAMIC_CALL                                            !5
         42        SEND_VAR_EX                                  

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
176.29 ms | 2434 KiB | 22 Q