Some basic code before I ask my question:
/**
* Associates all class variable names to the function name that sets it.
*
* Format: array(name of variable => function that creates it)
*/
function _ws_var_to_method_assoc() {
return
$this->var_assoc = array(
'uri_req_array' => 'func_req_array',
'uri_ss_array' => 'func_ss_array',
'uri_sliced_req_array' => 'func_sliced_req_array'
);
}
function _ws_var_set($var) {
$assoc = $this->_ws_var_to_method_assoc();
// some code that will set $var by calling the function that is associated to it in $assoc
}
Basically, I want ws_var_set() to attempt to set a variable by calling a function whose name is provided in the $assoc array that is returned by calling the ws_var_to_method_assoc() class method (see comments). Would something like eval() work?
My final objective is to be able to easily satisfy criteria in other methods.