In our 'Arrays' tutorial we showed you how to create a fixed size array. The code below declares the array using the Dim statement and passes in a parameter which specifies the maximum number of items that the array can contain. In this case it's 7 as the array has a zero based starting index.
Dynamic arrays come in handy when you aren't sure how many items your array will hold. To declare a dynamic array simply leave out the parameter.
Suppose you wished to create an array to hold all the item ID's in your visitors shopping cart. As you aren't sure how many items they'll purchase you could first of all create a dynamic array.
If your visitor then puts 3 items in their cart you could resize the array using the REDIM function (redimension).
If the visitor puts another item in their shopping cart you'll need to resize the array again. However you'd lose all the information in the existing array if you just used the Redim function. Using the keyword PRESERVE will keep the array we already have and increase the size.
In part 1 read about 'Arrays'
In part 2 read about 'Array
Functions'
In part 3 read about 'Multidimensional
Arrays'
Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.
Get your best asp web hosting provider now and save 25%