3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getFutureWeekday( string $startDate, int $numberOfDays, array $holidays = [] ): string { $dt = new DateTime($startDate); for ($i = 0; $i < $numberOfDays; ++$i) { do { $date = $dt->modify('+1 weekday')->format("Y-m-d"); echo $date . "\n"; } while (in_array($date, $holidays)); } echo "---\n"; return $date ?? $startDate; } echo getFutureWeekday('2022-03-30', 4, ['2022-04-05']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1mrUA
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'getfutureweekday'
          1        SEND_VAL                                                 '2022-03-30'
          2        SEND_VAL                                                 4
          3        SEND_VAL                                                 <array>
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
          6      > RETURN                                                   1

Function getfutureweekday:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 9
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 9
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 9
Branch analysis from position: 26
Branch analysis from position: 9
Branch analysis from position: 9
filename:       /in/1mrUA
function name:  getFutureWeekday
number of ops:  33
compiled vars:  !0 = $startDate, !1 = $numberOfDays, !2 = $holidays, !3 = $dt, !4 = $i, !5 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <array>
    9     3        NEW                                              $6      'DateTime'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !3, $6
   10     7        ASSIGN                                                   !4, 0
          8      > JMP                                                      ->24
   12     9    >   INIT_METHOD_CALL                                         !3, 'modify'
         10        SEND_VAL_EX                                              '%2B1+weekday'
         11        DO_FCALL                                      0  $10     
         12        INIT_METHOD_CALL                                         $10, 'format'
         13        SEND_VAL_EX                                              'Y-m-d'
         14        DO_FCALL                                      0  $11     
         15        ASSIGN                                                   !5, $11
   13    16        CONCAT                                           ~13     !5, '%0A'
         17        ECHO                                                     ~13
   14    18        INIT_FCALL                                               'in_array'
         19        SEND_VAR                                                 !5
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $14     
         22      > JMPNZ                                                    $14, ->9
   10    23    >   PRE_INC                                                  !4
         24    >   IS_SMALLER                                               !4, !1
         25      > JMPNZ                                                    ~16, ->9
   16    26    >   ECHO                                                     '---%0A'
   17    27        COALESCE                                         ~17     !5
         28        QM_ASSIGN                                        ~17     !0
         29        VERIFY_RETURN_TYPE                                       ~17
         30      > RETURN                                                   ~17
   18    31*       VERIFY_RETURN_TYPE                                       
         32*     > RETURN                                                   null

End of function getfutureweekday

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.08 ms | 1403 KiB | 16 Q