I see in some classes something like the following:
Illustrative class
class Carro
{
private static $quantidade = 5;
public function getQuantidade()
{
return self::$quantidade;
}
public function comprar()
{
self::$quantidade--;
}
}
What I want to know is the following, the self
operator calls the variable using two points: self::
. After all, what is this type of call for? Why was it used this way and not using the $this
= > $this->$quantidade
?