Arrays are an excellent way to use a single variable to hold multiple strands of related information. If you have a multiple strands of related information that you’d like to have together, arrays are the way to go. They allow you to set multiple pieces of information to one variable and output them based on a numerical pointer. What I’ve just said may sound confusing, however when you see the code below it’ll all seem a lot easier.

<?php
$names = array("Mike", "John", "Samuel", "Nick", "Ryan"); // names
echo($names[0]); // outputs "Mike"
echo($names[1]); // outputs "John"
echo($names[2]); // outputs "Samuel"
echo($names[3]); // outputs "Nick"
echo($names[4]); // outputs "Ryan"
?>

As you can see in the above code, arrays start at the numerical pointer “0”. So, if you have an array of names set to the “$names” variable, and there are 5 names in the array, the first name’s numerical pointer would be “0”. The second name’s numerical pointer would be “1” and so on. Simple stuff!