Welcome Guest, Not a member yet? Register   Sign In
call_user_func() vs. $func_name()
#4

[eluser]danmontgomery[/eluser]
[quote author="helmutbjorg" date="1286874403"]To call class methods you need to wrap the parameters into a single array like so:
Code:
// call_user_func(array($class, $function));
call_user_func(array($this->Sample_model->$func_name, $var));
[/quote]

This is incorrect.

Code:
call_user_func(array($this->sample_model, $func_name), $var);

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


Messages In This Thread
call_user_func() vs. $func_name() - by El Forum - 10-11-2010, 07:23 PM
call_user_func() vs. $func_name() - by El Forum - 10-11-2010, 08:47 PM
call_user_func() vs. $func_name() - by El Forum - 10-11-2010, 10:06 PM
call_user_func() vs. $func_name() - by El Forum - 10-12-2010, 07:04 AM
call_user_func() vs. $func_name() - by El Forum - 10-12-2010, 02:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB