<?php $paper[] = "Copier"; $paper[] = "Inkjet"; $paper[0] = "Copier"; $paper[1] = "Inkjet"; print_r($paper); for ($j = 0 ; $j < 4 ; ++$j) echo "$j: $paper[$j]<br>"; $paper['copier'] = "Copier & Multipurpose"; $paper['inkjet'] = "Inkjet Printer"; $paper['laser'] = "Laser Printer"; $paper['photo'] = "Photographic Paper"; echo $paper['laser']; $p1 = array("Copier", "Inkjet", "Laser", "Photo"); echo "p1 element: " . $p1[2] . "<br>"; $p2 = array('copier' => "Copier & Multipurpose", 'inkjet' => "Inkjet Printer", 'laser' => "Laser Printer", 'photo' => "Photographic Paper"); echo "p2 element: " . $p2['inkjet'] . "<br>"; foreach ($paper as $item => $description) echo "$item: $description<br>"; while (list($item, $description) = each($paper)) echo "$item: $description<br>"; echo "<pre>"; foreach ($products as $section => $items) foreach ($items as $key => $value) echo "$section:\t$key\t($value)<br>"; echo "</pre>"; $paper = array("Copier", "Inkjet", "Laser", "Photo"); $j = 0; foreach ($paper as $item) { echo "$j: $item<br>"; ++$j; } $temp = explode(' ', "This is a sentence with seven words"); $temp = explode('***', "A***sentence***with***asterisks"); print_r($temp); $fname = "Elizabeth"; $sname = "Windsor"; $address = "Buckingham Palace"; $city = "London"; $country = "United Kingdom"; $contact = compact('fname', 'sname', 'address', 'city', 'country'); print_r($contact); $j = 23; $temp = "Hello"; $address = "1 Old Street"; $age = 61; print_r(compact(explode(' ', 'j temp address age'))); ?>