I\'m wondering if PHP has a type of variable in classes that functions like static in other languages. And by that I mean all objects of the same class use the same variable and
You can update static properties:
class A {
protected static $_foo = 0;
public function increment()
{
self::$_foo++;
}
public function getFoo()
{
return self::$_foo;
}
}
$instanceOne = new A();
$instanceTwo = new A();
$instanceOne->getFoo(); // returns 0
$instanceTwo->increment();
$instanceOne->getFoo(); // returns 1