Passing parameters to functions in ASP is really a headache. When there are a large number of parameters (for example, there are seven or eight parameters or more parameters), it is almost impossible to see them, number one by one. What's even worse is that there must be no Ding errors in the parameter location. Every time I upload a bunch of parameters to a function, I feel very helpless ......
So I drew on the parameter passing method in PHP, put all the parameters in the array, and passed an array.
A function is written to implement an associated array similar to that in PHP:
<% Function assarray (iarray, Ikey) if not (isarray (iarray) Then assarray = NULL exit function end if Dim I, j, tmparr for I = 0 to ubound (iarray) if instr (iarray (I), "=>")> 0 then tmparr = Split (iarray (I), "=>") if isarray (tmparr) then if ucase (TRIM (tmparr (0) = ucase (TRIM (Ikey) Then assarray = tmparr (1) exit function end if next assarray = NULL end function 'usage dim myarr: myarr = array ("myname => name", "mytel => 110 ", "Gender => male") response. write assarray (myarr, "myname") & assarray (myarr, "gender") %>