PHPFront

Home > PHP > Arrays for beginners
The PHP website created by its users!



Arrays for beginners


Author
DescriptionA simple way of explaining the use of array's
RatingThis script has been rated 4/5 (3 votes)

PHP Code


[#] is the KEY of the array
"..." is the VALUE of the array

$access_level[0] = "Public";
$access_level[5] = "Clan Member";
$access_level[10] = "Administrator";

To display these items in a drop menu of a form:

<?php
echo "<select name="access" size="1">n";
    foreach (
$access_level as $access_key => $access_value) {
        echo 
"<option value="$access_key">$access_value</option>n";
    }
echo 
"</select>n";
?> 



Rate it: Print Print

Comments


No comments posted yet.

Name
Website
Your comment