Welcome Guest, Not a member yet? Register   Sign In
Variable function names
#1

[eluser]JonoB[/eluser]
Is it possible to use variables as function names?

Code:
$model = 'Product_model';
$function = 'count_products()';
$this->total_rows = $this->CI->$model->$function;

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
Severity: Notice
Message: Undefined property: Products::$count_products()
Filename: core/Model.php
Line Number: 50

Is there any way of getting around this?


Messages In This Thread
Variable function names - by El Forum - 02-22-2011, 02:04 PM
Variable function names - by El Forum - 02-22-2011, 04:11 PM
Variable function names - by El Forum - 02-23-2011, 05:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB