3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new \DateTime('+8 days'); $date = shiftDate($date); function shiftDate($date){ if (in_array((int)$date->format('N'), [6,7])){ $date->add(new \DateInterval('P1D')); $date = shiftDate($date); } return $date; } var_dump($date);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vmomV
function name:  (null)
number of ops:  12
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $1      'DateTime'
          1        SEND_VAL_EX                                              '%2B8+days'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
    4     4        INIT_FCALL_BY_NAME                                       'shiftDate'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $4      
          7        ASSIGN                                                   !0, $4
   12     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function shiftdate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/vmomV
function name:  shiftDate
number of ops:  22
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'in_array'
          2        INIT_METHOD_CALL                                         !0, 'format'
          3        SEND_VAL_EX                                              'N'
          4        DO_FCALL                                      0  $1      
          5        CAST                                          4  ~2      $1
          6        SEND_VAL                                                 ~2
          7        SEND_VAL                                                 <array>
          8        DO_ICALL                                         $3      
          9      > JMPZ                                                     $3, ->20
    7    10    >   INIT_METHOD_CALL                                         !0, 'add'
         11        NEW                                              $4      'DateInterval'
         12        SEND_VAL_EX                                              'P1D'
         13        DO_FCALL                                      0          
         14        SEND_VAR_NO_REF_EX                                       $4
         15        DO_FCALL                                      0          
    8    16        INIT_FCALL_BY_NAME                                       'shiftDate'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $7      
         19        ASSIGN                                                   !0, $7
   10    20    > > RETURN                                                   !0
   11    21*     > RETURN                                                   null

End of function shiftdate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
196.87 ms | 1004 KiB | 15 Q