3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { new DatePeriod(new DateTime('yesterday'), new DateInterval('P1D'), 'foo'); } catch (Exception $exception) { echo $exception->getMessage(), "\n"; } try { new DatePeriod(new DateTime('yesterday'), new DateInterval('P1D'), 'bar'); } catch (Exception $exception) { echo $exception->getMessage(), "\n"; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: DatePeriod::__construct() accepts (DateTimeInterface, DateInterval, int [, int]), or (DateTimeInterface, DateInterval, DateTime [, int]), or (string [, int]) as arguments in /in/567rL:3 Stack trace: #0 /in/567rL(3): DatePeriod->__construct(Object(DateTime), Object(DateInterval), 'foo') #1 {main} thrown in /in/567rL on line 3
Process exited with code 255.
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
DatePeriod::__construct(): This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments. DatePeriod::__construct(): This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments.

preferences:
184.25 ms | 403 KiB | 184 Q