10-24-2011, 02:42 PM
10-30-2011, 03:55 AM
Arrays are a very usefull feature in PHP and you'll find yourself using then more than you think. An array is just a fancy term for storing multiple data in a single variable. Take the $_POST variable, it's an array and contains the data that was sent in a form, you access that data by using its unique id. Eg, $_POST["username"] contains the data sent that has the unique identifier of "username".
Do you seem to understand now?
Google probably has a much better explanation than me though, haha.
Do you seem to understand now?
Google probably has a much better explanation than me though, haha.
10-30-2011, 02:13 PM
An array is used as an alternative to using multiple variables to hold values.
PHP Code:
<?PHP
$array = ("One", "Two", "Three"); //Define the array
Echo $array[0]; //Will echo "One"
Echo $array[2]; //Will echo "Three"
foreach ($array as $value){
Echo "$value, "; //Will echo "One, Two, Three, "
}
?>