I am a new PHP student . I want to create 3 functions to return Today, Yesterday, and Future.
Could anyone tell me how to create those?
I am a new PHP student . I want to create 3 functions to return Today, Yesterday, and Future.
Could anyone tell me how to create those?
You can use these function :
// midnight second or equal today
function isToday($time)
{
return (strtotime($time) === strtotime('today'));
}
//Yesterday
function isPast($time)
{
return (strtotime($time) < time());
}
// Next day
function isFuture($time)
{
return (strtotime($time) > time());
}