Revision: 43406
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 23, 2011 11:43 by slav123
Initial Code
/** * 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 ) { $date = strtotime( $data['birthday'] ); if( $date !== false && $date !== -1 ) { // strtotime returns -1 < PHP 5.1.0 $diff = time() - $date; return ( $diff / 31556926 > $reqAge ); // 31556926 seconds in a year } return false; // date malformed }
Initial URL
http://bin.cakephp.org/view/1184217660
Initial Description
Initial Title
Cake PHP age validation
Initial Tags
Initial Language
PHP