Hi Andrew,

Andrew Yochum wrote:
Consider that one may only
want __call to respond to a computable set of overloaded method names.

Usually, this is done by something like this:

<?php
class Test {
    public function __call($method, $args) {
        switch ($method) {
            case 'method_name_1':
                // handle method_name_1
                break;
            case 'method_name_2':
                // handle method_name_2
                break;
            default:
throw new Exception('Call to undefined method ' . __CLASS__ . '::' . $method . '()');
         }
    }
}

$t = new Test();
$t->nonexistant();
?>

I see your point with detection by something like __is_callable(), although I can't personally think of a place where I'd use it.

Mike

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to