PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

call_user_method> <Classes/Objects
Last updated: Mon, 26 Nov 2007

view this page in

call_user_method_array

(PHP 4 >= 4.0.5, PHP 5)

call_user_method_array — 调用一个用户方法,同时传递参数数组(已废弃)

说明

mixed call_user_method_array ( string $method_name , object &$obj , array $paramarr )
Warning

call_user_method_array() 函数自 PHP 4.1.0 起已废弃,使用 call_user_func_array() 函数和 array(&$obj, "method_name") 语法代替。

从用户定义的 obj 对象中调用 method_name 所指的方法,同时使用 paramarr 中的参数。

参见 call_user_func_array()call_user_func()



add a note add a note User Contributed Notes
call_user_method_array
cesutherland gmail com
11-Apr-2008 07:44
Instead of this you should use call_user_func_array($function, $params) by passing array($classname, $methodname) as the $function.

<?php
call_user_func_array
(array($obj, $method_name), $params);
?>
leonwinter at gmail dot com
02-Oct-2006 07:45
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.

call_user_method> <Classes/Objects
Last updated: Mon, 26 Nov 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites