3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param Int $days * @return DatePeriod */ function getNumDays($days) { $today = new \DateTime('UTC'); $oneDay = new \DateInterval('P1D'); return new \DatePeriod($today, $oneDay, $days); } foreach(getNumDays(7) as $day){ //Do what ever you want with the DateTime instance //We'll just var_dump() it for now. var_dump($day); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/RYQbk
function name:  (null)
number of ops:  11
compiled vars:  !0 = $day
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'getnumdays'
          1        SEND_VAL                                                 7
          2        DO_FCALL                                      0  $1      
          3      > FE_RESET_R                                       $2      $1, ->9
          4    > > FE_FETCH_R                                               $2, !0, ->9
   17     5    >   INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   14     8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $2
   18    10      > RETURN                                                   1

Function getnumdays:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RYQbk
function name:  getNumDays
number of ops:  16
compiled vars:  !0 = $days, !1 = $today, !2 = $oneDay
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        NEW                                              $3      'DateTime'
          2        SEND_VAL_EX                                              'UTC'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
    9     5        NEW                                              $6      'DateInterval'
          6        SEND_VAL_EX                                              'P1D'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $6
   11     9        NEW                                              $9      'DatePeriod'
         10        SEND_VAR_EX                                              !1
         11        SEND_VAR_EX                                              !2
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
         14      > RETURN                                                   $9
   12    15*     > RETURN                                                   null

End of function getnumdays

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.06 ms | 1399 KiB | 16 Q