3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Rfc7231Formatter { public static function format(DateTimeImmutable $dt): string { return $dt->setTimezone(new DateTimeZone('GMT'))->format('D, d M Y H:i:s') . ' GMT'; } } echo Rfc7231Formatter::format(new DateTimeImmutable('2026-01-21 12:23:34.567890+01:00')); echo PHP_EOL; echo Rfc7231Formatter::format(new DateTimeImmutable('2026-01-21 12:23:34.567890-08:00'));
Output for 8.3.5 - 8.3.30, 8.4.9 - 8.4.17, 8.5.1 - 8.5.2
Wed, 21 Jan 2026 11:23:34 GMT Wed, 21 Jan 2026 20:23:34 GMT

preferences:
53.17 ms | 406 KiB | 5 Q