1. Call the method directly
Copy the code The code is as follows:
function test($ a, $b)
{
echo 'Test 1:'.$a.$b;
}
//Call the test method, array("asp", 'php') corresponds Parameters
call_user_func_array('test', array("asp", 'php'));
2. Call the method in the class through the class
Copy the code The code is as follows:
class test2{
function phpSay($a, $b)
{
echo 'Test 2:'.$a.$b;
}
}
$o = new test2();
//Equivalent to: $o->phpSay('php','Hello');
call_user_func_array(array(&$o, 'phpSay'), array('php' ,'Hello'));
http://www.bkjia.com/PHPjc/327512.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327512.htmlTechArticle1. Directly call the method to copy the code. The code is as follows: function test($a, $b) { echo 'Test 1 :'.$a.$b; } //Call the test method, array("asp", 'php') corresponds to the corresponding parameter call_user_func_...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn