I want to trigger a function based on a variable.
function sound_dog() { return \'woof\'; } function sound_cow() { return \'moo\'; } $animal = \'cow\'; print soun
You can use $this-> and self:: for class-functions. Example provided below with a function input-parameter.
$this->
self::
$var = 'some_class_function'; call_user_func(array($this, $var), $inputValue); // equivalent to: $this->some_class_function($inputValue);