Dynamic Call

A dynamic call happens when part of the syntax comes from a variable, and is not known at code writing time.

PHP allows every syntax to be used as a dynamic call.

<?php

    $constant = 'Name';
    echo constant($constant);
    echo constant("someClass::$constant");

    $variable = 'a';
    $a = 'b';
    echo $$variable; // b

    $function = 'mine';
    $function($arg);

    $className = '\stdclass';
    new $className;

    $method = 'method';
    $object->$method();

    echo $object::CONSTANT;

?>

Documentation

See also All the Dynamic Syntaxes in PHP.

Related : Anonymous, Code Injection, Dynamic, Static Call