note 70072 modified in function.call-user-method-array by bobby
| From: | bobby@php.net | Date: | Mon, 02 Oct 2006 17:45:19 +0000 |
| Subject: | note 70072 modified in function.call-user-method-array by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-117953@lists.php.net to get a copy of this message | ||
If you this function will be deleted in future php releases you can use this function:
<?
function _call_user_method_array($name, $obj, $params) {
// get params
$txt = "";
foreach($params as $nr => $el) {
$txt.='$params['.$nr."], ";
}
$txt = substr($txt, 0, strlen($txt)-2);
// run it
return eval('return call_user_method($name, $obj, '.$txt.');');
}
?>
Hope this helps somebody.
--was--
If you this function will be deleted in future php releases you can use this function:
<?
if(!function_exists("call_user_method_array")) {
function call_user_method_array($name, $obj, $params) {
// get params
$txt = "";
foreach($obj as $nr => $el) {
$txt.='$'.$name."[".$nr."], ";
}
$txt = substr($txt, 0, strlen($txt)-2);
// run it
return eval('return call_user_method($name, $obj, '.$txt.');');
}
}
?>
Hope this helps somebody.
http://php.net/manual/en/function.call-user-method-array.php