DJ Mike's Tutorials: PHP

Arrays


< ^ >

Arrays

If you think of a variable as a container like a bucket that can temporarily hold data, you can think of an array as more like a filing cabnet. A variable can hold different values at different times but at any one time, but it holds only one value. An array is like a variable that can hold any number of values at a time. The variables can be different data types, numbers, strings, boolean values, even other arrays.

The items in an array are called elements and are indexed by a number or string. You can loop through the entire array or access a single element by its index. By default, arrays are indexed by numbers starting with 0. The index of an element is also called its key. When an array is indexed with strings, it is called an associative array.


< ^ >



Created by DJ Mike from Santa Barbara

DJ Mike


Dance Away Santa Barbara's Home Page
<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>