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

Static Call

A static call is a call to a structure, where the name of the structure is hardcoded.

A static method may be called with a static call, or with a dynamic call. Both are valid.

<?php

    class Elephpant {
        static function trumpet() {}
    }

    new Elephpant(); // static call

    $class = Elephpant::class;
    new $class(); // dynamic call

    Elephpant::trumpet(); // static call of a static method
    $class::trumpet(); // dynamic call of a static method

?>

Documentation

See Also