Arrays allow for a variable to have multiple values. This gives you the ability to create lists of names, and be able to sort them easily. Also it allows you to have values from a variable such as a user that include name, email address, phone number, etc.
The numbered index for values that are created start with number 0, not 1 for when accessing values.
<?php $names = array('bob','sue','ted','ralph'); print_r($names); print "<br>"; print $names; ?>
Be the first to comment