Basics to arrays Welcome to the arrays tutorial. Summary: We will be looking into what arrays are and how to make and use them. An array is a list of data. Here's what an array would look like. Code:
$array = array('This is number 0','this is number 1','this is number 2');
echo $array[0]; //will print This is number 0 echo $array[1];//will print this is number 1 echo $array[2];//will print this is number 2 ?> I'm hoping you've noticed that to call the first piece of data you use the variable name which is $array followed by [0] and for the next piece of data you would do the same accept this time you would replace [0] with [1]. There's a more advanced way to call out all the data from an array which is probably too advanced for this tutorial, but seeing the there might be some quick learners ill show it. Code:
$array = array('value 0','value 1','value 2'); //the array
for($i=0; $i echo $array[$i].' '; } ?> What this does is it checks how many pieces of data there are in the array and sets $i to 0, so untill $i is the same amount as the amount of data in the array it keeps looping. If you would like more help with this tutorial please register and visit the forum. |
About Michael
“But I am already older than 21”, I hear you cry.
Don’t worry, despite the name, the information and advice is more geared towards retiring prior to having a fake hip installed. Website Sponsors
Recommended Websites
Feature Interviews
Graham went from $100
one day to ...
Read more
Paul Bourque started affiliate marketing
less than ...
Read more
Interview with Yaro
Starak of Entrepreneurs-Journey.com is ...
Read more
Recommended Resources
|
||||||
Get Retire at 21's FREE Secrets
Find out how I'm going to Retire VERY Early Subscribe for my Free Secrets Privacy Guaranteed. 100% Spam free. |
|||||||