How to check that date is today and yesterday in php?

How to check that date is today and yesterday in php?

Use this function for get today and yesterday

function get_day_name($time) {
$date = date('d/m/Y', $time);
            if($date == date('d/m/Y')) {
            $time_since = 'Today';
            } else if($date == date('d/m/Y',now() - (24 * 60 * 60))) {
            $time_since = 'Yesterday';
            }else
            {
            $time_since = 'Today';
            }
return $time_since;
}
       


Comments