Web Development

  Homes arrow Web Development arrow Multi-dimensional arrays
 Webmaster Tools
 
Base64 Encoding 
Browser Settings 
CSS Coder 
CSS Navigation Menu 
Datetime Converter 
DHTML Tooltip 
Dig Utility 
DNS Utility 
Dropdown Menu 
Fetch Content 
Fetch Header 
Floating Layer 
htaccess Generator 
HTML to PHP 
HTML Encoder 
HTML Entities 
IP Convert 
Meta Tags 
Password Encryption
 
Password Strength
 
Pattern Extractor 
Ping Utility 
Pop-Up Window 
Regex Extractor 
Regex Match 
Scrollbar Color 
Source Viewer 
Syntax Highlighting 
URL Encoding 
Web Safe Colors 
Forums Sitemap 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WEB DEVELOPMENT

Multi-dimensional arrays
By: Developer Shed
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2004-05-22

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     

    SEARCH DEV MECHANIC

    TOOLS YOU CAN USE

    advertisement


    by: Codefixer.com

    Multi-dimensional arrays

    Tip- think of multi-dimensional arrays in terms of a table holding columns and rows.
    To create a multi-dimensional array simply specify the number of columns and rows you want the array to have.

    myArray(2,3) would have 3 columns and 4 rows, this would basically be like a regular array that has 3 columns, but with 4 rows.

    And here is some ASP code that demonstrates the use of a multi-dimensional array:
    Think of each cell holding a value. Below cell (0,3) holds a "bmw".

      0 1 2
    0 toyota white 22.000
    1 ford blue 12.500
    2 porshe red 50.000
    3 bmw yellow 26.000

    Look at the code below which holds the values in the table above;

    Dim myArray(2,3)

    'myArray(col,row)
    myArray(0,0) = "toyota"
    myArray(1,0) = "white"
    myArray(2,0) = "22.000"
    myArray(0,1) = "ford"
    myArray(1,1) = "blue"
    myArray(2,1) = "12.500"
    myArray(0,2) = "porshe"
    myArray(1,2) = "red"
    myArray(2,2) = "50.000"
    myArray(0,3) = "bmw"
    myArray(1,3) = "yellow"
    myArray(2,3) = "26.000"


    This snippet of code will use the myArray(2,3) above
    <%
    Response.Write "<table border='0'>"
    Response.Write "<tr><td>Row</td><td>Car</td>"
    Response.Write "<td>Color</td><td>Cost</td></tr>"
    'UBound(myArray,2) will return the highest element in the array for the '2' dimension. 'In this case '2' signifies the rows dimension, '1' which
    ' is the default would have meant columns
    'the highest element in the row column in this case is 3
    'so we could look on our loopcounter going from For i=0 to 3
    For i = 0 to UBound(myArray, 2)
    Response.Write "<tr><td>" & i & "</td>"
    Response.Write "<td>" & myArray(0,i) & "</td>"
    Response.Write "<td>" & myArray(1,i) & "</td>"
    Response.Write "<td>" & myArray(2,i) & "</td></tr>"
    Next
    Response.Write "</table>"
    %>

    The above yields the following result:

    Row  Car             Color        Cost
    0       toyota         white        22.000
    1       ford            blue          12.500
    2       porshe        red           50.000
    3       bmw           yellow       26.000

     


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Web Development Articles
    More By Developer Shed

    Antalya bayan escortescort AntalyaAntalya bayan escortAntalya escort bayanBursa bayan escortescort BursaBursa escort partner

       

    WEB DEVELOPMENT ARTICLES

    - On Page SEO for New Domains
    - Improve Your Site`s Speed
    - Safari Books Online Review
    - Creating an Estore From the Ground Up
    - Most Common SEO Mistakes Developers Make
    - Making the Most of Your Titles and Meta Desc...
    - Five Ways Using Flash Can Damage Your Site
    - A Web Designer`s Guide to Colors
    - Use Webstarts to Create a Free Site
    - More Than Just Looks. How Your Web Design C...
    - How to Design Content Pages
    - Mint Review
    - Make Your WordPress Website Look Professional
    - How to Create a Mobile Web Site
    - Meta Tags: Still Useful?

    Developer Shed Affiliates

     



    © 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap