You will store somewhere the string
$f = "somedescriptivefunctionName";
and then call the function by specifying its name in curly brackets:
$this->{$f}('Yahoo!!');
EDIT
According to the comment section, the aim is to call a method of an instance of another class by the same name. You can extend the config class to achieve a somewhat similar behavior, but I think that's not acceptable as a solution in this case. You can convert your class into a decorator, like
class SomeClassDecorator
{
protected $_instance;
public function myMethod() {
return strtoupper( $this->_instance->someMethod() );
}
public function __construct(SomeClass $instance) {
$this->_instance = $instance;
}
public function __call($method, $args) {
return call_user_func_array(array($this->_instance, $method), $args);
}
public function __get($key) {
return $this->_instance->$key;
}
public function __set($key, $val) {
return $this->_instance->$key = $val;
}
// can implement additional (magic) methods here ...
}
The code above was copied from Gordon's amazing answer here: How to add a method to an existing class in PHP?
An evolution of this idea could be to create a decorator for your config class as a base class and extend that base class for your classes that are configured by this, so you will implement a single decorator and (re)use it.