Home > php教程 > php手册 > php中while(list($key,$val)=each($result))详解获取数组

php中while(list($key,$val)=each($result))详解获取数组

WBOY
Release: 2016-06-13 09:52:07
Original
1065 people have browsed it

在php中while(list($key,$val)=each($result)) 是就读取$result数组值并循环获取数组内容赋值给$key,$val哦。

 代码如下 复制代码


echo "类CAR中的所有方法名为:";

echo "

";

$result=get_class_methods("CAR"); //获取类CAR中的方法名get_class_methods()

while(list($key,$val)=each($result))   //循环获取数组内容

{

  echo "方法$key=>$val";

  echo "

";

}

list() 函数用数组中的元素为一组变量赋值。

注意,与 array() 类似,list() 实际上是一种语言结构,不是函数

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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template