Dynamic

Dynamic is a common concept in PHP, and may be used in three distinct situations:

  • dynamic call, to call a function or method whose name is in a variable

  • dynamic constant, to call a constant whose name is in a variable

  • dynamic property, to access a property whose name is in a variable

  • dynamic loading, for PHP to load an extension after the start of execution

  • dynamic variable, to access a variable whose name is in another variable.

<?php

    // Dynamic call of a variable
    $a = K;
    $x = 'a';
    echo $$x; // K

    const A = 1;
    $name = 'A';
    echo constant($name); // 1

?>

See also All the Dynamic Syntaxes in PHP.

Related : Dynamic Call, Dynamic Constant, Dynamic Properties, Dynamic Loading, Dynamic Variable, Variable Variables, static, Dynamic Class Constant, Dynamic Method