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

foreach遍历数组

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:38:05
Original
1184 people have browsed it

无详细内容 无 ?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/>";
}
 
?>
Copy after login
source:php.cn
Statement of this Website
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
Latest Issues
foreach problem
From 1970-01-01 08:00:00
0
0
0
Breaking if and foreach
From 1970-01-01 08:00:00
0
0
0
Loop problem, foreach
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template