Reputation: 294
Let's keep it simple. We have this:
public function db($method)
{
$this->$method.'()';
}
I'am sure this is pretty self explanatory. Basically I want all my methods to be called trough this method 'db', but this is the error:
Message: Undefined property: site::$db
Ehm...
I guess I could write all the possible cases by hand, but is it really necessary??
Upvotes: 2
Views: 29
Reputation: 682
Did you tried call_user_func($function);
Or
$this->$function()
Or
$this->{$function}()
Upvotes: 1