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('P7D'); $week = new DatePeriod($datetime, $interval, 6); foreach($week as $day){ $result[] = $day->format('D d m Y H:i:s'); } return $result; } //and the difficult ones:- var_dump(daysInWeek(1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LWEBq
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'daysinweek'
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > 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/LWEBq
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                                              'P7D'
         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:
157.37 ms | 1394 KiB | 16 Q