At the moment I have something like this
function callFunction($method, $args) {
if(method_exists($this, $method)) {
call_user_func_array(array($this, $method), $args);
}
}
function myfunction ($hello, $world, $blah) {
}
where $args
is an array like [0] => 'string1', [1] => 'string2', [2] => 'string3'
which gets passed to the function in that order. However would there be a way to have the keys to the args match the functions argument names. like ['hello'] => 'string1', ['world'] => 'string2', ['blah'] => 'string3'
where they could be in any order and be matched to the correct argument name by key?