3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Prior 8.1 for php +1 month https://www.php.net/manual/en/datetime.examples-arithmetic.php function printDiff($tz) { $d1 = new \DateTime("2015-06-01", new \DateTimeZone($tz)); $d2 = new \DateTime("2015-07-01", new \DateTimeZone($tz)); $diff = $d1->diff($d2); print($diff->format("Start: " . ((new \DateTime('@'.($d1->format("U"))))->format("Y-m-d H:i:s")) . " End: " . ((new \DateTime('@'.($d2->format("U"))))->format("Y-m-d H:i:s")) . " Year: %Y Month: %M Day: %D") .PHP_EOL); } \printDiff("UTC"); \printDiff("Australia/Melbourne");

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
154.33 ms | 2040 KiB | 12 Q