PHP Current Week Number

I did not fully test this for every scenario and leap years. But it worked for what I was using it for. If anyone has any bugs with it, let me know.

function currWeek()
{
$dateArray = getdate();
$yday = $dateArray['yday'];
$wday = $dateArray['wday'];
$cMon 	= $yday – $wday;
$currWk = ceil($cMon/7);
return $currWk;
}

 

Leave a Reply