3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date1 = new \DateTime('first day of this month'); echo $date1->format('Y-m-d') . "\n"; $date1->setDate(2016, 1, 8); echo $date1->format('Y-m-d') . "\n"; $date2 = new \DateTime('first day of january'); echo $date2->format('Y-m-d') . "\n"; $date2->setDate(2016, 3, 8); echo $date2->format('Y-m-d') . "\n";

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
112.85 ms | 1956 KiB | 4 Q