You can use the PHP date() function along with strtotime() to get yesterday’s date in PHP. Here’s an example code snippet:
$yesterday = date("Y-m-d", strtotime("-1 day"));
echo $yesterday;
In this example, we’re using the “Y-m-d” format for the date, which outputs the date in the format of “YYYY-MM-DD”. The strtotime() function takes a string argument, which in this case is “-1 day”, indicating that we want to subtract one day from the current date.
The $yesterday variable will now contain yesterday’s date in the format “YYYY-MM-DD”, which you can use in your PHP code as needed.