Why is this legal in PHP?
<?php class Foo { public function test() { echo "hello "; } } Foo::test(); ?>
test() is a non-static function but I can access it without an instance.
It's legal, but generally frowned upon, until you reference $this in your statically called method which will throw a fatal error.
$this
1.4m articles
1.4m replys
5 comments
57.0k users