Posted by Windcape Thu 1st Mar 2007 05:25 - Syntax is PHP - 30 viewsRun this post in the PHP shell
Download | New Post | Modify | Show line numbers
PHP parser reported no syntax errors in this post!


class Person
{
    private $firstName;
    private $lastName;
    private $age;
    private $sex;

    public function __construct($firstName,$lastName,$age,$sex) {
        $this->firstName = $firstName;
        $this->lastName  = $lastName;
        $this->age = (int)$age;
        $this->sex = $sex;
    }

    public function getYearOfBirth() {
        $today = (int)date("Y"); // 2007
        return $today - $this->age;
    }

}

$person = new Person('Claus','Joergensen',20,'male');
echo $person->getYearOfBirth(); // 1987 ... okay, a bit wrong :) I'm from '86

?>

PermaLink to this entry https://pastebin.co.uk/11198
Posted by Windcape Thu 1st Mar 2007 05:25 - Syntax is PHP - 30 viewsRun this post in the PHP shell
Download | New Post | Modify | Show line numbers

 

Comments: 0