Calling Static Method inside non-Static Method


I would like to know if the following is correct way of doing?

class Foo
    static public function Hello() {
        return 'Hello';

    public function World(){
    	return self::Hello() .' World';

Here I am calling a static method inside a non-static method. It works for sure, but just wanted to confirm if its correct way??


Yep that’s correct! At least that’s how I do it too.

So its not illegal to call a static method inside a non-static method unlike the other way?

Absolutely not. All the static keyword is doing is allowing that function to be called without first constructing the class.

Invokes the constructor:

$foo = new Foo();
print $foo->World();

Does not:

print Foo::Hello();

Your always allowed to reference that static method, even using self::