script that calculates the current age up to the last day.. grammar correct.
By : voldomazta
<?
function curage($gm,$gd,$gy){
/** * Current Age Script * Coded by Ramon Alivio Jr. (2005-06-12) * Iloilo City, Philippines * http://www.thermokarst.co.nr * * Usage: -- echo curage(m,d,y); -- * Where 'm' is birth month, 'd' is birth day * and 'y' is birth year **/
case 0: $r .= ($m == 0 && $y == 0 ? 'Today' : ''); break; case 1: $r .= ($m == 0 && $y == 0 ? $d.' day old' : ($y != 0 || $m != 0 ? ' and '.$d.' day old' : '')); break; default: $r .= ($m == 0 && $y == 0 ? $d.' days old' : ($y != 0 || $m != 0 ? ' and '.$d.' days old' : ''));
}
}
return $r;
}
?>
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.