note 99041 deleted from function.strtotime by danbrown

From: Date: Sat, 24 Jul 2010 00:32:55 +0000
Subject: note 99041 deleted from function.strtotime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-171081@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- Here's a simple function to verify someone's age. Could be useful for validating a date of birth when entering a site etc. <?php function is_old_enough($required_age, $dobm, $dobd, $doby){ return mktime(0, 0, 0, $dobm, $dobd, $doby) <= strtotime("-$required_age year"); } if(is_old_enough(18, $_POST['dobm'], $_POST['dobd'], $_POST['doby'])){ echo 'Welcome, you may enter this site.'; }else{ echo 'Sorry, you\'re too young to enter this site.'; } ?>

« previous php.notes (#171081) next »