Welcome Guest, Not a member yet? Register   Sign In
__call function equivalent.
#6

[eluser]Jelmer[/eluser]
Try something like this, using call_user_func_array():
Code:
function _remap()
{
    $params = $this->uri->segment_array();
    $function = array_shift($params);
    call_user_func_array(array($this, $function), $params);
}
I'd suggest adding some security measures (maybe only allow when it doesn't start with an underscore, like normal CI behavior), but basicly this should work.

Edit: I first posted it with the depricated call_user_method_array(), I just updated it to the non-depcrecated call_user_func_array().


Messages In This Thread
__call function equivalent. - by El Forum - 06-18-2010, 05:21 AM
__call function equivalent. - by El Forum - 06-18-2010, 05:53 AM
__call function equivalent. - by El Forum - 06-18-2010, 06:26 AM
__call function equivalent. - by El Forum - 06-18-2010, 06:31 AM
__call function equivalent. - by El Forum - 06-18-2010, 06:46 AM
__call function equivalent. - by El Forum - 06-18-2010, 08:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB