Dynamic Method¶
A dynamic method is a method which is defined at execution time.
This is convenient for module systems or SOAP clients, where the actual methods are defined at the remote server.
PHP calls this overloading.
<?php
class X {
function __call($name, $args) {
if ($name === 'aaa') {
echo 'OK';
return;
}
if ($name === 'bbb') {
echo 'OK';
return;
}
echo 'KO';
}
}
$x = new X;
$x->aaa(); // OK
$x->bbb(); // OK
$x->ccc(); // KO
?>
See also PHP: Dynamic method calling.
Related : Dynamic, Overloading