Using sort to alphabetize
<?php $shapes = array("rectangle", "cylinder", "sphere"); sort($shapes); foreach ($shapes as $key => $val) { echo "shapes[" . $key . "] = " . $val . "<br />"; } ?>