View Single Post
Old 10-13-2008, 09:11 PM   #4 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

It is quite simple, you'll just have to find a place in your code to insert it. I hope it helps you!

php Code:
function has_subscription_expired($iTimestamp, $iDays = 30)
{
    $iNadir = strtotime(sprintf('-%d days', $iDays));
   
    if ($iTimestamp < $iNadir)
    {
        return true;
    }
   
    return false;
}

var_dump(has_subscription_expired(strtotime('-35 days'))); // true
var_dump(has_subscription_expired(strtotime('-30 days'))); // false
var_dump(has_subscription_expired(strtotime('-25 days'))); // false
 
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote