I'm wondering: Why would I need to use a static variable? When I initiate a class, that class remembers the value of a variable I declare in that class anyway, right? What does the static part add to that?
For example, what's the difference between
class Hello
{
public $variable;
function increaseByOne()
{
$this->variable++;
}
}
and
class Hello
{
public static $variable;
function increaseByOne()
{
self::$variable++;
}
}
? When I execute either of the functions 10 times, $variable will always be 10, right?