To compare the set time with the current time:
if (strtotime($given_time) >= time()+300) echo "You are online";
300 is the difference in seconds you want to check. In this case, 5 minutes once 60 seconds.
If you want to compare two arbitrary times, use:
if (strtotime($timeA) >= strtotime($timeB)+300) echo "You are online";
To know : this will not succeed if the time is on different dates, for example 23:58 Friday and 00:03 Saturday, since you pass the time only as a variable. You would be better off storing and comparing Unix timestamps for starters.
source share