3v4l.org

run code in 500+ PHP versions simultaneously
<?php $endDate = new DateTime('01-01-'.date('Y')); echo $endDate; // 2017-01-01
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught Error: Object of class DateTime could not be converted to string in /in/CNEvL:3 Stack trace: #0 {main} thrown in /in/CNEvL on line 3
Process exited with code 255.

preferences:
41.5 ms | 1267 KiB | 4 Q