Quantcast
Channel: In PHP is there a way to alias function/method calls? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

In PHP is there a way to alias function/method calls?

$
0
0

I'm not talking about aliasing the actual function/method name itself but aliasing their calls:

$test->some_method($a,$b);

Can we alias the above as something like:

$t_sm($a,$b);

Again, I'm not talking about aliasing the actual function/method name, but rather their actual calls, minus the parameters.

EDIT

And no, I don't want to create wrapper functions. And strictly looking at readability purpose here. It's much more readable that way.

EDIT

When aliasing the actual method call it includes the name of the object including the method it's calling. Where as if I aliased just the method, i would still have to call the object on it explicitly.

EDITIs there a method call aliasing such that:

class Foo{       function Bar($msg)    {        echo $msg;    }}$f_b = 'Foo::Bar';$msg = "calling method Bar via method-call-aliasing.";$f_b($msg);

It creates instance of Foo and aliases that instance as well as the method specified('Bar' part of string 'Foo::Bar').


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images