A Static Method Cannot Call A Non Static Method¶
<?php
class X {
static function foo() {
self::goo();
}
function goo() { }
}
(new x)->foo();
It is known that a non-static method can call a static method. It is less known that a static method cannot call a non-static method, even if the static syntax is possible.
A non-static method needs a value for $this, which a static call doesn’t provide.
See Also¶
cannot call static [Try me]
PHP Features¶
Last updated: 14 July 2026