I saw several people ask a similar question. But I need to clarify this question a bit.
I have several functions that pass multiple arguments. I even have a few of 10 arguments. (originally did not plan, just grew over time)
I have no problem finding the source code to find out what the 7th argument is, but it is tedious. Most of the time I know what arguments need to be passed, not a position.
I had a few ideas to simplify the process for me.
a) pass 1 argument, but split everything into some sort of delimiter. (but this is a bad idea !, since I still need to remember everyone’s position.
function myfunc('data|data|data|'){
b) pass the array with the key and values and look for the key names inside my function and act accordingly.
function myfunc(array('arg1' => 'blah blah', 'arg2' => 'more blah')){
c) keep it as is.
function myfunc($arg1,$arg2,$arg3,$arg4,$arg5........){
So, I'm looking for other options and better ideas for handling functions with growing lists of arguments.
source share