2

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??

1 Answer 1

1

Did you tried call_user_func($function); Or

$this->$function()

Or

$this->{$function}()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.