SE13013
SE13013

Reputation: 343

Check if current time is 1 minute past previously-saved time in PHP

I'm saving the time to a variable called $time, using $time = time(), and later on, I need to be able to check to see if the current time is greater than 1 minute by comparing the current time with the previously-saved time.

How can I do this in PHP?

Upvotes: 0

Views: 334

Answers (1)

Muhammet
Muhammet

Reputation: 3308

You can save the time to database or session, but this is how you would check

$time = time();

if((time() - $time) > 60){
    echo 'past 1 minute';
}

Upvotes: 2

Related Questions