Home > Backend Development > PHP Tutorial > 关于php中的数组遍历

关于php中的数组遍历

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:03:13
Original
950 people have browsed it

不知道php中有没有检测数组长度的函数?java中直接用.length就可以,php中没找到,php中应该如何检测数组长度?谢谢。


回复讨论(解决方案)

count(数组)

	$ar=array(1,2,3,4,5,6,7);	$cnt=count($ar);	echo $cnt;
Copy after login

不知道php中有没有检测数组长度的函数?java中直接用.length就可以,php中没找到,php中应该如何检测数组长度?谢谢。
+1

count或sizeof,查查手册。

count()

在php中这两个统计长度的比较常用。
count()  :统计数组的单元数目或对象中得属性个数。
strlen() :统计字符串的个数

count(数组)
正解

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