Since you are claiming that you already understand what static means, I will skip this.
However, it may be useful to refer to the PHP documentation in the static key . In particular, the following two warnings are important (and it's hard to peek, really).
Caution In PHP 5, calling non-static methods statically generates an E_STRICT level warning .
And this one (italics mine).
Warning In PHP 7, calling static methods has been statically deprecated and will generate an E_DEPRECATED warning. Support for calling non-static methods may be statically removed in the future.
So, to shorten the long story: yes, your example will work (for now), because the PHP interpreter will try to fix your mistake for you. However, you will never do it . The PHP interpreter will do the following:
Say your $obj is of type Foo . Then he will read
$obj->staticMethod($para1, $para2);
conclude that staticMethod is static and instead performs
Foo::staticMethod($para1, $para2);
Of course, it's great to pass parameters that are properties of the Foo instance. It does not matter staticMethod where the parameters are taken.
More details on why this works when using $this in the static method is not allowed.
You can think of normal methods as static functions that have one additional: they get the implicit parameter $this . The value of $this is just the object on which the method is called. Thus, $obj->do($a, $b, $c) equivalent to calling Foo::do($obj, $a, $b, $c) and the name of the first argument do , $this . This is convenient because now we can easily define methods that work on an instance of an object without having to explicitly indicate again and again that this instance is a parameter of our methods. Excellent.
Now back to the static functions. The only difference from conventional methods is that they do not receive this implicit parameter $this . Thus, using $this inside them is not valid. Not because it is forbidden, but because nothing is said. PHP cannot (and cannot) understand what $this should mean.
Another way to look at it. Let's say that our Foo class has two properties: $para1 and $para2 , both numbers. Say you are writing a method that returns the sum of these numbers. One way to do this:
public static function sum($para1, $para2) { return $para1 + $para2; }
Great. Works. However, it is annoying to call it as follows
$sum = Foo::sum($obj->para1, $obj->para2);
So, what are the methods for!
public function sum(/* implicit $this parameter */) { // write looking up the properties once inside the function, instead // of having to write it every time we call the function! return $this->para1 + $this->para2; } // ... $sum = $obj->sum(); // $obj is passed implicitly as $this
Since static functions do not receive the implicit $this parameter, using $this inside it is like trying to use $undefined when you never defined it. So itβs wrong.