3v4l.org

run code in 500+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); $dto = new DateTime('2024-01-30 23:01:00'); $dto->setISODate(2024, 1); $fmt = new IntlDateFormatter('de_DE', IntlDateFormatter::NONE, IntlDateFormatter::NONE, 'Europe/Berlin'); $fmt->setPattern('LLL dd'); // Hint: $dto->getTimestamp() is the date a week ago, but with current time. So its always the time its called. $week_start = $fmt->format($dto->getTimestamp()); $dto->modify('+6 days'); // for sunday $week_end = $fmt->format($dto->getTimestamp()); echo $week_start . ' - ' . $week_end;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/de5CL
function name:  (null)
number of ops:  42
compiled vars:  !0 = $dto, !1 = $fmt, !2 = $week_start, !3 = $week_end
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'date_default_timezone_set'
          1        SEND_VAL                                                     'UTC'
          2        DO_ICALL                                                     
    5     3        NEW                                                  $5      'DateTime'
          4        SEND_VAL_EX                                                  '2024-01-30+23%3A01%3A00'
          5        DO_FCALL                                          0          
          6        ASSIGN                                                       !0, $5
    6     7        INIT_METHOD_CALL                                             !0, 'setISODate'
          8        SEND_VAL_EX                                                  2024
          9        SEND_VAL_EX                                                  1
         10        DO_FCALL                                          0          
    8    11        NEW                                                  $9      'IntlDateFormatter'
         12        SEND_VAL_EX                                                  'de_DE'
         13        FETCH_CLASS_CONSTANT                                 ~10     'IntlDateFormatter', 'NONE'
         14        SEND_VAL_EX                                                  ~10
         15        FETCH_CLASS_CONSTANT                                 ~11     'IntlDateFormatter', 'NONE'
         16        SEND_VAL_EX                                                  ~11
         17        SEND_VAL_EX                                                  'Europe%2FBerlin'
         18        DO_FCALL                                          0          
         19        ASSIGN                                                       !1, $9
    9    20        INIT_METHOD_CALL                                             !1, 'setPattern'
         21        SEND_VAL_EX                                                  'LLL+dd'
         22        DO_FCALL                                          0          
   13    23        INIT_METHOD_CALL                                             !1, 'format'
         24        INIT_METHOD_CALL                                             !0, 'getTimestamp'
         25        DO_FCALL                                          0  $15     
         26        SEND_VAR_NO_REF_EX                                           $15
         27        DO_FCALL                                          0  $16     
         28        ASSIGN                                                       !2, $16
   14    29        INIT_METHOD_CALL                                             !0, 'modify'
         30        SEND_VAL_EX                                                  '%2B6+days'
         31        DO_FCALL                                          0          
   15    32        INIT_METHOD_CALL                                             !1, 'format'
         33        INIT_METHOD_CALL                                             !0, 'getTimestamp'
         34        DO_FCALL                                          0  $19     
         35        SEND_VAR_NO_REF_EX                                           $19
         36        DO_FCALL                                          0  $20     
         37        ASSIGN                                                       !3, $20
   17    38        CONCAT                                               ~22     !2, '+-+'
         39        CONCAT                                               ~23     ~22, !3
         40        ECHO                                                         ~23
   18    41      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.3 ms | 494 KiB | 10 Q