<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <id>tag:www.refactormycode.com,2007:users1717</id>
  <link type="application/atom+xml" href="http://www.refactormycode.com/users/1717" rel="self"/>
  <title>gordon0580.myopenid.com</title>
  <updated>Mon Feb 08 04:30:29 -0800 2010</updated>
  <entry>
    <id>tag:www.refactormycode.com,2007:Code1170</id>
    <published>2010-02-08T04:30:29-08:00</published>
    <updated>2010-05-03T00:26:48-07:00</updated>
    <title>[PHP] How to get age from given birthdate</title>
    <content type="html">&lt;p&gt;How to get age from given birthdate&lt;/p&gt;

&lt;pre&gt;&amp;lt;?php
function getAge($birthdate) {
    return floor((time() - strtotime($birthdate))/(60*60*24*365.2425));
}
?&amp;gt;&lt;/pre&gt;</content>
    <author>
      <name>gordon0580.myopenid.com</name>
      <email>no-email@refactormycode.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/1170-how-to-get-age-from-given-birthdate" rel="alternate"/>
  </entry>
  <entry>
    <id>tag:www.refactormycode.com,2007:Refactor313931</id>
    <published>2009-09-21T04:06:38-07:00</published>
    <title>[PHP] On User Registration Function</title>
    <content type="html">&lt;p&gt;In cakePHP, you can do this.&lt;/p&gt;

&lt;pre&gt;## Model [php]
&amp;lt;?php
class User extends AppModel {
    var $name = 'User';
}
?&amp;gt;

## Controller [php]
&amp;lt;?php
class UserController extends AppController {
    var $name = 'User';

    function add() {
        if(!empty($this-&amp;gt;data)) {
            if ($this-&amp;gt;User-&amp;gt;save($this-&amp;gt;data)) {
                $this-&amp;gt;Session-&amp;gt;setFlash(__('The User has been saved', true));
                $this-&amp;gt;redirect(array('controller' =&amp;gt; 'users', 'action'=&amp;gt;'index'));
            } else {
                $this-&amp;gt;Session-&amp;gt;setFlash(__('The User could not be saved. Please, try again.', true));
            }
        }
    }
}
?&amp;gt;
&lt;/pre&gt;</content>
    <author>
      <name>gordon0580.myopenid.com</name>
      <email></email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/966-user-registration-function/refactors/313931" rel="alternate"/>
  </entry>
</feed>

