Variable function names |
[eluser]JonoB[/eluser]
Is it possible to use variables as function names? Code: $model = 'Product_model'; The model part seems to work fine, but it gets stuck at the $function part and php throws an error. Code: A PHP Error was encountered Is there any way of getting around this?
[eluser]CroNiX[/eluser]
I think it will work if you put the parenthesis after the variable function name, not in the actual variable. $model = 'Product_model'; $function = 'count_products'; $this->total_rows = $this->CI->$model->$function(); http://php.net/manual/en/functions.varia...ctions.php
|
Welcome Guest, Not a member yet? Register Sign In |