<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>PHP is Fun!</title>
	<atom:link href="http://phpisfun.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpisfun.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sun, 30 Mar 2008 06:10:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='phpisfun.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>PHP is Fun!</title>
		<link>http://phpisfun.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://phpisfun.wordpress.com/osd.xml" title="PHP is Fun!" />
	<atom:link rel='hub' href='http://phpisfun.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Get current age based on birthdate</title>
		<link>http://phpisfun.wordpress.com/2008/03/30/get-current-age-based-on-birthdate/</link>
		<comments>http://phpisfun.wordpress.com/2008/03/30/get-current-age-based-on-birthdate/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 05:58:17 +0000</pubDate>
		<dc:creator>nicholasarnold</dc:creator>
				<category><![CDATA[hypertext preprocessor]]></category>
		<category><![CDATA[age calculator]]></category>
		<category><![CDATA[age function]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[get current age]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php functions]]></category>

		<guid isPermaLink="false">http://phpisfun.wordpress.com/?p=3</guid>
		<description><![CDATA[I wrote a quick little function that simply returns a persons current age by inputting their birthday as a DATE (YYYY-MM-DD). If you want to use the function, go ahead, but please leave a comment! If you find a way to shorten it or make it run faster, please let me know! I&#8217;m always open [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpisfun.wordpress.com&amp;blog=3319111&amp;post=3&amp;subd=phpisfun&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I wrote a quick little function that simply returns a persons current age by inputting their birthday as a DATE (YYYY-MM-DD).</p>
<p>If you want to use the function, go ahead, but please leave a comment! If you find a way to shorten it or make it run faster, please let me know! I&#8217;m always open to new ways of doing things, especially faster/more efficient ways.</p>
<pre><code>
function get_current_age($bday)
{
	/* Calculates current age. $bday must be in DATE format
	(YYYY-MM-DD). Returns false if $bday is not the right
	format OR if it is in the future */
	if (!ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $bday)) {
		return false;
	}
	$cy = date('Y');
	$cm = date('n');
	$cd = date('j');
	$bday = explode("-",$bday);
	$yob = $bday[0];
	$mob = ltrim($bday[1],"0"); // remove leading zero
	$dob = ltrim($bday[2],"0"); // remove leading zero

	$age = $cy - $yob;
	if ($cm &lt; $mob) {
		$age--;
	}
	else if ($cm == $mob) {
		if ($cd &lt; $dob) {
			$age--;
		}
	}

	if ($age &gt;= 0) {
		return $age;
	}
	else {
		return false;
	}
}
</code></pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/phpisfun.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/phpisfun.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/phpisfun.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/phpisfun.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/phpisfun.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/phpisfun.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/phpisfun.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/phpisfun.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/phpisfun.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/phpisfun.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/phpisfun.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/phpisfun.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/phpisfun.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/phpisfun.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/phpisfun.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/phpisfun.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=phpisfun.wordpress.com&amp;blog=3319111&amp;post=3&amp;subd=phpisfun&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://phpisfun.wordpress.com/2008/03/30/get-current-age-based-on-birthdate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5e86f320d78609072bc4fda514b592b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nicholasarnold</media:title>
		</media:content>
	</item>
	</channel>
</rss>
