hi all.
i kinda know one can't pass an array as a parameter, as it has to be text, or an interger (doesn't it?).
i got this piece of code that i want to turn into a function. basically i collect a lot of data related to the same object, and then i insert the info onto a database.
the fields are like 20, so having 20 parameters sounds a little crazy, and would make it easy to make some mistake.
the only solution i thought about would be to put all the data into an array, using it from the function as a global var, and the parameter would just be the array name. kind like this:
what do you guys think?HTML Code:function function_name($array_name) { global $array_name; // do stuff } $array_name = array(); $array_name['foo'] = "some value"; $array_name['val'] = "some other value"; function_name($array_name);
is there a better way?
thanks!







Bookmarks