/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Poor man's age limit validation * Due to the lack of simple and exact PHP time diff function, * we conveniently forget leap years */ function ageLimit( $data, $reqAge ) { if( $date !== false && $date !== -1 ) { // strtotime returns -1 < PHP 5.1.0 return ( $diff / 31556926 > $reqAge ); // 31556926 seconds in a year } return false; // date malformed }
URL: http://bin.cakephp.org/view/1184217660