so here is an example code script you can use to see how a single dimesional arrays works:
Lets say i have a choice of 5 cities, all starting with "San" so here are my five cities:
1. San Francisco
2. San Diego
3. San Fernando
4. San Antonio
5. San Bernandino
So i want my script to display a message that say "I live in San Antonio"
this is how the script would look like:
Code:
<?php
$cities[0] = "San Francisco";
$cities[1] = "San Diego";
$cities[2] = "San Fernando";
$cities[3] = "San Antonio";
$cities[4] = "San Bernandino";
print ("I live in $cities[3].<br>");
?>
$cities[0] = "San Francisco";
$cities[1] = "San Diego";
$cities[2] = "San Fernando";
$cities[3] = "San Antonio";
$cities[4] = "San Bernandino";
print ("I live in $cities[3].<br>");
?>
Output:
Code:
I live in San Antonio.
REMEMBER: You will need a website with php, i you don't have php already, signup with www.webune.com with one of their PHP plans.
Another tool you can use is notepad to create script. open your notepad and copy and paste it into notepad and save it as arrays.php and upload to your php webiste to see it in action.
