3v4l.org

run code in 300+ PHP versions simultaneously
<?php $d1 = new DateTime('12/10/2012 05:33'); $d2 = new DateTime('12/10/2012'); $d3 = new DateTime('12/10/2012 00:00'); $d4 = new DateTime('12/10/2012 00:00:00'); function isMidnight(DateTime $dt): bool { return !trim($dt->format('Hisu'), '0'); } var_dump(isMidnight($d1), isMidnight($d2), isMidnight($d3), isMidnight($d4));

preferences:
29.45 ms | 405 KiB | 5 Q