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;
Output for 8.5.1 - 8.5.11
Fatal error: Uncaught Error: Class "IntlDateFormatter" not found in /in/qmnTA:11 Stack trace: #0 {main} thrown in /in/qmnTA on line 11
Process exited with code 255.
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.35, 8.3.0 - 8.3.36, 8.4.1 - 8.4.27, 8.5.0, 5.5.5 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.29
Jan 01 - Jan 07
Output for 7.4.33
Fatal error: Uncaught Error: Class 'IntlDateFormatter' not found in /in/qmnTA:11 Stack trace: #0 {main} thrown in /in/qmnTA on line 11
Process exited with code 255.
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.26
Fatal error: Class 'IntlDateFormatter' not found in /in/qmnTA on line 11
Process exited with code 255.
Output for 5.0.2
Fatal error: Class 'DateTime' not found in /in/qmnTA on line 2
Process exited with code 255.
Output for 4.4.2
Parse error: syntax error, unexpected ',', expecting '(' in /in/qmnTA on line 11
Process exited with code 255.
Output for 4.3.4
Parse error: parse error, expecting `'('' in /in/qmnTA on line 11
Process exited with code 255.

preferences:
43.52 ms | 1530 KiB | 18 Q