3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param DateTime $date * @return bool */ function firstDayOfMonth(\DateTime $date) { return (int)$date->format('d') <= 7 && $date->format('l') === 'Monday'; } $day = new \DateTime('2013/9/2'); var_dump(firstDayOfMonth($day));

preferences:
39.58 ms | 402 KiB | 5 Q