Home >php教程 >php手册 >foreach遍历数组

foreach遍历数组

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 19:38:051200browse

无详细内容 无 ?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/>";
}
 
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn