3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dt = new DateTime('2024-01-08 00:01:00 last week monday 00:00:01', new DateTimeZone('Europe/Berlin')); $year = (int)$dt->format('Y'); $week = (int)$dt->format('W'); // After this, I call a second script with parameters ($year and $week) few times for different tasks $dto = new DateTime(); $dto->setISODate($year, $week); $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/qmnTA
function name:  (null)
number of ops:  56
compiled vars:  !0 = $dt, !1 = $year, !2 = $week, !3 = $dto, !4 = $fmt, !5 = $week_start, !6 = $week_end
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   NEW                                                  $7      'DateTime'
          1        SEND_VAL_EX                                                  '2024-01-08+00%3A01%3A00+last+week+monday+00%3A00%3A01'
          2        NEW                                                  $8      'DateTimeZone'
          3        SEND_VAL_EX                                                  'Europe%2FBerlin'
          4        DO_FCALL                                          0          
          5        SEND_VAR_NO_REF_EX                                           $8
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !0, $7
    3     8        INIT_METHOD_CALL                                             !0, 'format'
          9        SEND_VAL_EX                                                  'Y'
         10        DO_FCALL                                          0  $12     
         11        CAST                                              4  ~13     $12
         12        ASSIGN                                                       !1, ~13
    4    13        INIT_METHOD_CALL                                             !0, 'format'
         14        SEND_VAL_EX                                                  'W'
         15        DO_FCALL                                          0  $15     
         16        CAST                                              4  ~16     $15
         17        ASSIGN                                                       !2, ~16
    8    18        NEW                                                  $18     'DateTime'
         19        DO_FCALL                                          0          
         20        ASSIGN                                                       !3, $18
    9    21        INIT_METHOD_CALL                                             !3, 'setISODate'
         22        SEND_VAR_EX                                                  !1
         23        SEND_VAR_EX                                                  !2
         24        DO_FCALL                                          0          
   11    25        NEW                                                  $22     'IntlDateFormatter'
         26        SEND_VAL_EX                                                  'de_DE'
         27        FETCH_CLASS_CONSTANT                                 ~23     'IntlDateFormatter', 'NONE'
         28        SEND_VAL_EX                                                  ~23
         29        FETCH_CLASS_CONSTANT                                 ~24     'IntlDateFormatter', 'NONE'
         30        SEND_VAL_EX                                                  ~24
         31        SEND_VAL_EX                                                  'Europe%2FBerlin'
         32        DO_FCALL                                          0          
         33        ASSIGN                                                       !4, $22
   12    34        INIT_METHOD_CALL                                             !4, 'setPattern'
         35        SEND_VAL_EX                                                  'LLL+dd'
         36        DO_FCALL                                          0          
   16    37        INIT_METHOD_CALL                                             !4, 'format'
         38        INIT_METHOD_CALL                                             !3, 'getTimestamp'
         39        DO_FCALL                                          0  $28     
         40        SEND_VAR_NO_REF_EX                                           $28
         41        DO_FCALL                                          0  $29     
         42        ASSIGN                                                       !5, $29
   17    43        INIT_METHOD_CALL                                             !3, 'modify'
         44        SEND_VAL_EX                                                  '%2B6+days'
         45        DO_FCALL                                          0          
   18    46        INIT_METHOD_CALL                                             !4, 'format'
         47        INIT_METHOD_CALL                                             !3, 'getTimestamp'
         48        DO_FCALL                                          0  $32     
         49        SEND_VAR_NO_REF_EX                                           $32
         50        DO_FCALL                                          0  $33     
         51        ASSIGN                                                       !6, $33
   20    52        CONCAT                                               ~35     !5, '+-+'
         53        CONCAT                                               ~36     ~35, !6
         54        ECHO                                                         ~36
   21    55      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
139.12 ms | 509 KiB | 9 Q