Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The call_user_method_array function is deprecated what replaces it? [duplicate]

Tags:

php

Possible Duplicate:
Recommended replacement for deprecated call_user_method?
Function in PHP deprecated, what should I use now?

The call_user_method_array function is deprecated so what should I use to achieve the same outcome?

like image 289
DiverseAndRemote.com Avatar asked Dec 26 '22 10:12

DiverseAndRemote.com


2 Answers

From the manual:

Example #1 call_user_method_array() alternative

 <?php
 call_user_func_array(array($obj, $method_name), $params);
 call_user_func_array(array(&$obj, $method_name), $params); // PHP 4
 ?>
like image 77
Kermit Avatar answered Jan 14 '23 11:01

Kermit


The call_user_method_array() function is deprecated as of PHP 4.1.0.

Now You can use the call_user_func_array (callable $callback, array $parameters), where $callback or string function name or an array ( $object, $function_name ).

http://php.net/manual/en/function.call-user-func-array.php

like image 28
Vahe Shadunts Avatar answered Jan 14 '23 12:01

Vahe Shadunts