Andrey Hristov wrote:
>>.....
>>.....
ah, the code has an error and I found more efficient way (for objects no need of string compare):
<?php
class Fubar {
protected function doSomething_integer_integer_double($i1,$i2,$f) {
$a = func_get_args();var_dump(__METHOD__, $a);
}
protected function doSomething_integer_double($i,$f) {
$a = func_get_args();var_dump(__METHOD__, $a);
}
protected function doSomething_objectFubar($fub) {
$a = func_get_args();var_dump(__METHOD__, $a);
}


        public function doSomething() {
                $args = func_get_args();
                $method_name = __FUNCTION__;
                foreach ($args as $v) {
                        $method_name .= "_".gettype($v);
                        if (FALSE !==($c_name = get_class($v))) {
                                $method_name .= $c_name;
                        }
                }
                if (method_exists($this, $method_name)) {
                        return call_user_func_array(array($this, $method_name), $args);
                }
        }
}//class fubar

$a = new fubar();
$a->doSomething(1, 2.0);
$a->doSomething(3,4, 5.0);
$a->doSomething($a);
?>

OTOH hinting for array (internally) will be nice also.

Cheers,
Andrey

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



Reply via email to