Sorry for the question but I don't understand how this works:
class Person {
public static $age = 1;
public function haveBirthday() {
static::$age +=1;
}
}
$joe = new Person;
$joe->haveBirthday();
echo Person::$age;
What I'm not understanding is this:
public function haveBirthday() {
static::$age +=1;
}
Isn't supposed to return $age otherwise the value is lost? Why is it still working?
Thanks!