I am trying to build a function that will call another function.
For example, if I have an array full of function names to call, is it possible to call a function for every array value without writing it in a script?
Example:
function email($val=NULL) {
    if($val)
        $this->_email = $val;
    else
        return $this->_email;
}
function fname($val=NULL) {
    if($val)
        $this->_fname = $val;
    else
        return $this->_fname;
}
For email, fname, etc.
But I want to have it like:
function contr_val($key,$val) {
    function $key($val=NULL) {
        if($val)
            $this->_$key = $val;
        else
            return $this->_$key;
    }
    function $key($val="hallo");
}
And call it with:
contr_val("email", "test")
 
     
     
     
     
     
    