Length of an array in ASP by using UBound function

We can get the length or total number of element in the array by using UBound() function. Note that the index of the first element of the array is 0. So if there are five elements inside an array then the function UBound() will return 4. Here is the code to get the highest index of the array. Note that total element is 1 plus the highest index.

Dim myArray(3) 'Re-Declaring a dynamic array

myArray(0) = "UK"
Response.Write ("Total element of the array = " & UBound(myArray) )

for i=0 to uBound(myArray)
Response.Write "<br>" & myArray(i)
Here UBound is used to set the maximum looping length to display each element of the array.

In PHP array length or size is found out by using sizeof function

Be the first to post comment on this article :


Post your comments , suggestion , error , requirements etc here .

We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer