-
- function test($a, $b)
- {
- echo 'Test 1:'.$a.$b;
- }
- //Call the test method, array("asp", 'php') corresponds to the corresponding parameters
- call_user_func_array('test', array("asp", 'php'));
- ?>
Copy the code
2. Call the method in the class through the class
-
- 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' ));
- ?>
Copy code
|