PHP OOP Test

class Animal {
  private $itsAge; //not int
  public function __construct($startAge) { $this->itsAge = $startAge; }
  public function getAge() { return $this->itsAge; }
}
$bear = new Animal(5);
print "
Our bear is ".$bear->getAge()." years old.
";

Our bear is 5 years old.

FItem


Creating FItem username!
$someItem's name: username.
Creating FItem title!
$myTextbox's name: title.
$myTextbox's length: .
Setting Length to 4!
$myTextbox's name: title.
$myTextbox's length: 4.

Multiple "extend"s

class A {
  public function af() { print 'a';}
  public function bark() {print ' arf!';}
}
class B extends A {
  public function bf() { print 'b';}
}
class C extends B {
  public function cf() { print 'c';}
  public function bark() {print ' ahem...'; parent::bark();}
}

$c = new C;
$c->af(); $c->bf(); $c->cf();
print "<br />";
$c->bark();
abc
ahem... arf!

Paamayim Nekudotayim - Scope Resolution Operator

class A2 {
  public function af() { print 'a';}
  public function bark() {print ' arf!';}
}
class B2 extends A2 {
  public function bf() { print 'b';}
  public function bark() {print ' w00f!';}
}
class C2 extends B2 {
  public function cf() { print 'c';}
  public function bark() {print ' ahem...'; A::bark();}
}

$c = new C;
$c->af(); $c->bf(); $c->cf();
print "<br />";
$c->bark();
abc
ahem... arf!