3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = 'Saturday-Thursday'; list($begin, $end) = explode('-', $str); $begin = new DateTime($begin); $end = new DateTime($end); $end = $end->modify( '+1 day' ); $interval = new DateInterval('P1D'); $daterange = new DatePeriod($begin, $interval ,$end); $result = []; foreach($daterange as $date){ $result[] = $date->format("l"); } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 34, Position 2 = 41
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 41
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/8LNP3
function name:  (null)
number of ops:  46
compiled vars:  !0 = $str, !1 = $begin, !2 = $end, !3 = $interval, !4 = $daterange, !5 = $result, !6 = $date
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, 'Saturday-Thursday'
    4     1        INIT_FCALL                                                   'explode'
          2        SEND_VAL                                                     '-'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $8      
          5        FETCH_LIST_R                                         $9      $8, 0
          6        ASSIGN                                                       !1, $9
          7        FETCH_LIST_R                                         $11     $8, 1
          8        ASSIGN                                                       !2, $11
          9        FREE                                                         $8
    6    10        NEW                                                  $13     'DateTime'
         11        SEND_VAR_EX                                                  !1
         12        DO_FCALL                                          0          
         13        ASSIGN                                                       !1, $13
    7    14        NEW                                                  $16     'DateTime'
         15        SEND_VAR_EX                                                  !2
         16        DO_FCALL                                          0          
         17        ASSIGN                                                       !2, $16
    8    18        INIT_METHOD_CALL                                             !2, 'modify'
         19        SEND_VAL_EX                                                  '%2B1+day'
         20        DO_FCALL                                          0  $19     
         21        ASSIGN                                                       !2, $19
   10    22        NEW                                                  $21     'DateInterval'
         23        SEND_VAL_EX                                                  'P1D'
         24        DO_FCALL                                          0          
         25        ASSIGN                                                       !3, $21
   11    26        NEW                                                  $24     'DatePeriod'
         27        SEND_VAR_EX                                                  !1
         28        SEND_VAR_EX                                                  !3
         29        SEND_VAR_EX                                                  !2
         30        DO_FCALL                                          0          
         31        ASSIGN                                                       !4, $24
   13    32        ASSIGN                                                       !5, <array>
   15    33      > FE_RESET_R                                           $28     !4, ->41
         34    > > FE_FETCH_R                                                   $28, !6, ->41
   16    35    >   INIT_METHOD_CALL                                             !6, 'format'
         36        SEND_VAL_EX                                                  'l'
         37        DO_FCALL                                          0  $30     
         38        ASSIGN_DIM                                                   !5
         39        OP_DATA                                                      $30
   15    40      > JMP                                                          ->34
         41    >   FE_FREE                                                      $28
   19    42        INIT_FCALL                                                   'print_r'
         43        SEND_VAR                                                     !5
         44        DO_ICALL                                                     
         45      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
205.33 ms | 1930 KiB | 14 Q