3v4l.org

run code in 300+ PHP versions simultaneously
<?php function daysInWeek($weekNum) { $result = array(); $datetime = new DateTime('00:00:00'); $datetime->setISODate((int)$datetime->format('o'), $weekNum, 1); $interval = new DateInterval('P1D'); $week = new DatePeriod($datetime, $interval, 6); foreach($week as $day){ $result[] = $day->format('D d m Y H:i:s'); } return $result; } var_dump(daysInWeek(24)); //and the difficult ones:- var_dump(daysInWeek(1)); var_dump(daysInWeek(53));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HqSEv
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'daysinweek'
          2        SEND_VAL                                                 24
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   19     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'daysinweek'
          8        SEND_VAL                                                 1
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   20    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'daysinweek'
         14        SEND_VAL                                                 53
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function daysinweek:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 33
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 33
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/HqSEv
function name:  daysInWeek
number of ops:  36
compiled vars:  !0 = $weekNum, !1 = $result, !2 = $datetime, !3 = $interval, !4 = $week, !5 = $day
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        NEW                                              $7      'DateTime'
          3        SEND_VAL_EX                                              '00%3A00%3A00'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $7
    6     6        INIT_METHOD_CALL                                         !2, 'setISODate'
          7        INIT_METHOD_CALL                                         !2, 'format'
          8        SEND_VAL_EX                                              'o'
          9        DO_FCALL                                      0  $10     
         10        CAST                                          4  ~11     $10
         11        SEND_VAL_EX                                              ~11
         12        SEND_VAR_EX                                              !0
         13        SEND_VAL_EX                                              1
         14        DO_FCALL                                      0          
    7    15        NEW                                              $13     'DateInterval'
         16        SEND_VAL_EX                                              'P1D'
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !3, $13
    8    19        NEW                                              $16     'DatePeriod'
         20        SEND_VAR_EX                                              !2
         21        SEND_VAR_EX                                              !3
         22        SEND_VAL_EX                                              6
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !4, $16
   10    25      > FE_RESET_R                                       $19     !4, ->33
         26    > > FE_FETCH_R                                               $19, !5, ->33
   11    27    >   INIT_METHOD_CALL                                         !5, 'format'
         28        SEND_VAL_EX                                              'D+d+m+Y+H%3Ai%3As'
         29        DO_FCALL                                      0  $21     
         30        ASSIGN_DIM                                               !1
         31        OP_DATA                                                  $21
   10    32      > JMP                                                      ->26
         33    >   FE_FREE                                                  $19
   13    34      > RETURN                                                   !1
   14    35*     > RETURN                                                   null

End of function daysinweek

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.06 ms | 1452 KiB | 17 Q