PHP associated array simulation in ASP

Source: Internet
Author: User

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") %>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.