3v4l.org

run code in 500+ 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.2.31, 8.3.5 - 8.3.31, 8.4.9 - 8.4.23, 8.5.1 - 8.5.8
Wed, 21 Jan 2026 11:23:34 GMT Wed, 21 Jan 2026 20:23:34 GMT

preferences:
56.08 ms | 572 KiB | 4 Q