I suppose you could butcher magic methods for this:
class Magic
{
public function __call($method, $args) {
// would seriously recommend checking whether `$method` exists :)
return call_user_func_array($method, $args);
}
}
$magic = new Magic;
$str = <<<EOM
Hello this should give the {$magic->time()}.
EOM;