<?php
/**
* Check if a given date is the first Monday of the month
*
* @param \DateTime $date
* @return bool
*/
function isFirstMondayayOfMonth(DateTime $date)
{
return (int)$date->format('d') <= 7 && $date->format('l') === 'Sunday';
}
$day = new DateTime('2015/1/3');
var_dump(isFirstMondayayOfMonth($day));
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
bool(false)