3v4l.org

run code in 300+ PHP versions simultaneously
<?php //DateTime $date_mutable = new DateTime('2008-07-01T22:35:17+08:00'); $start_mutable = DateTime::createFromFormat( 'Y-m-d H:i:s.u', $date_mutable->format('Y-m-d').' 00:00:00.000000', $date_mutable->getTimeZone() ); $end_mutable = $start_mutable->add(new DateInterval('P1D')); //DateTimeImmutable $date_immutable = new DateTimeImmutable('2008-07-01T22:35:17+08:00'); $start_immutable = DateTimeImmutable::createFromFormat( 'Y-m-d H:i:s.u', $date_immutable->format('Y-m-d').' 00:00:00.000000', $date_immutable->getTimeZone() ); $end_immutable = $start_immutable->add(new DateInterval('P1D')); var_dump([ 'Date Mutable Formatted' => $date_mutable->format('Y-m-d H:i:s.u P'), 'Start Date Mutable Formatted' => $start_mutable->format('Y-m-d H:i:s.u P'), 'End Date Mutable Formatted' => $end_mutable->format('Y-m-d H:i:s.u P'), 'Date Immutable Formatted' => $date_immutable->format('Y-m-d H:i:s.u P'), 'Start Date Immutable Formatted' => $start_immutable->format('Y-m-d H:i:s.u P'), 'End Date Immutable Formatted' => $end_immutable->format('Y-m-d H:i:s.u P'), ]);
Output for 5.6.0 - 5.6.23, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
array(6) { ["Date Mutable Formatted"]=> string(33) "2008-07-01 22:35:17.000000 +08:00" ["Start Date Mutable Formatted"]=> string(33) "2008-07-02 00:00:00.000000 +08:00" ["End Date Mutable Formatted"]=> string(33) "2008-07-02 00:00:00.000000 +08:00" ["Date Immutable Formatted"]=> string(33) "2008-07-01 22:35:17.000000 +08:00" ["Start Date Immutable Formatted"]=> string(33) "2008-07-01 00:00:00.000000 +08:00" ["End Date Immutable Formatted"]=> string(33) "2008-07-02 00:00:00.000000 +08:00" }
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
191.68 ms | 408 KiB | 5 Q