How can the strtotime() function be used to calculate the date of the "last Thursday" in PHP?

To calculate the date of the "last Thursday" in PHP, you can use the strtotime() function in combination with the "last Thursday" keyword. This function will return a Unix timestamp for the specified date. You can then format this timestamp using the date() function to get the date in the desired format.

$lastThursday = strtotime("last Thursday");
$lastThursdayDate = date("Y-m-d", $lastThursday);
echo "The date of the last Thursday is: " . $lastThursdayDate;