<html>
<body>
<h1>Array Processing</h1>
<?php
$list1 = array( 'apples', 'bananas', 'oranges');
$list2 = array( 1=>'doors', 2=>'windows', 5=>'floors', 6=>'walls');
$list3 = array( 'Mon'=>'chicken', 'Tue'=>'beef', 'Wed'=>'fish');
print "<br> list1 = ";
print_r($list1); //print_r dumps the array
print "<br> list2 = ";
print_r($list2);
print "<br> list3 = ";
print_r($list3);
print "<br>";
$fruit = $list1[2]; //oranges, why?
print "<br> list1[2] = $fruit";
$list1[ ] = "strawberries"; //add another element to the end of $list1
print "<br> list1[ ] = strawberries <i>(add to end)</i>";
$construction = $list2[1]; //doors
print "<br> list2[1] = $construction";
$list2[ ] = "ceiling";
print "<br> list2[ ] = ceiling <i>(add to end)</i>";
print "<br> list3[Tue] = $list3[Tue]"; //beef
$day = "Mon";
print "<br> list3[$day] = $list3[$day]"; //using a variable as an index
$list3['Wed'] = "vegetarian"; //change element Wed to vegetarian
print "<br> list3[Wed] = vegeterian <i>(change)</i>";
$list3['Thu'] = "pork"; //add another element to $list3
print "<br> list3[Thu] = pork <i>(add)</i>";
print "<br>";
print "<br> list1 = ";
print_r($list1);
print "<br> list2 = ";
print_r($list2);
print "<br> list3 = ";
print_r($list3);
?>
<?php include "zCode/include.php"; ?> <!-- hyperlink to see the code -->
</body>
</html>