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

[eluser]ericrjones1[/eluser]
Any one please correct me if I am wrong.

I think the reason call_user_func doesn't work is because of the way Models are loaded into the framework. Models don't become globally accessible (i.e., accessible outside of the framework) once loaded, hence the need for "$this" (meaning the CI Framework) when referencing a Model.

By using $this->MY_Model->$some_method($var), you are still accessing the Model via the framework (notice "$this").

Hope this helps.


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