Dynamic Call¶
A dynamic call happens when part of the syntax comes from a variable, and is not known at code writing time.
In PHP, every syntax may use 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;
?>
See also All the Dynamic Syntaxes in PHP