Organizational Research By

Surprising Reserch Topic

recommended replacement for deprecated call user method using -'php,deprecated'


recommended replacement for deprecated call user method  using -'php,deprecated'

Since PHP's call_user_method() and call_user_method_array() are marked deprecated I'm wondering what alternative is recommended?

One way would be to use call_user_func(), because by giving an array with an object and a method name as the first argument does the same like the deprecated functions. Since this function is not marked deprecated I assume the reason isn't the non-OOP-stylish usage of them?

The other way I can think of is using the Reflection API, which might be the most comfortable and future-oriented alternative. Nevertheless it's more code and I could image that it's slower than using the functions mentioned above.

What I'm interested in:


Is there a completely new technique for calling an object's methods by name?
Which is the fastest/best/official replacement?
What's the reason for deprecation?

    
asked Sep 8, 2015 by rajesh
0 votes
13 views



Related Hot Questions



Government Jobs Opening


...