- <?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/>";
- }
- ?>
- //该片段来自于http://www.codesnippet.cn/detail/2304201512398.html
来源: http://www.codesnippet.cn/detail/2304201512398.html