?php/* * foreach */ $fruits = array("lemon" , "orange" , "banana" , "apple");sort($fruits);$n = count($fruits);echo "Length of fruits is: ".$n."br/"; foreach ($fruits as $key = $val) { echo "fruits[".$key."] = ".$val."br/";} ?
<?php /* * foreach */ $fruits = array("lemon" , "orange" , "banana" , "apple"); sort($fruits); $n = count($fruits); echo "Length of fruits is: ".$n."<br/>"; foreach ($fruits as $key => $val) { echo "fruits[".$key."] = ".$val."<br/>"; } ?>