I am studying PHP,OOP and i am at Static,
At this php.net/static i didnt understand this sentence
Calling non-static methods statically generates an E_STRICT level warning.
I did understand it’s Valid for methods only (not for Properties) by the sentence above,
but i didn’t succeed to understand It practically,
I’m glad if anything could please show me code that explains the sentence above,
Wishing you a pleasant week.
print Foo::$my_static . "\n";is OK – static property accessed statically.print Foo::staticValue(). "\n";gives E_STRICT – non-static method accessed statically, but not Fatal error, because this method doesn’t access non-static properties.Other two give Fatal error because non-static field cannot be accessed statically.