Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

PHP Features

Last updated: 10 September 2026