3v4l.org

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

End of function shiftdate

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.31 ms | 2038 KiB | 14 Q