PHP sizeof() 函数
PHP 教程
· 2019-01-22 22:58:59
实例
返回数组中元素的数目:
<?php
$cars=array("Volvo","BMW","Toyota");
echo sizeof($cars);
?>
$cars=array("Volvo","BMW","Toyota");
echo sizeof($cars);
?>
定义和用法
sizeof() 函数返回数组中元素的数目。
sizeof() 函数是 count() 函数的别名。
语法
sizeof(array,mode);
参数 | 描述 |
---|---|
array | 必需。规定要计数的数组。 |
mode | 可选。规定函数的模式。可能的值:
|
技术细节
返回值: | 返回数组中元素的数目。 |
---|---|
PHP 版本: | 4+ |
更多实例
实例 1
递归地计算数组中元素的数目:
<?php
$cars=array
(
"Volvo"=>array
(
"XC60",
"XC90"
),
"BMW"=>array
(
"X3",
"X5"
),
"Toyota"=>array
(
"Highlander"
)
);
echo "Normal count: " . sizeof($cars)."<br>";
echo "Recursive count: " . sizeof($cars,1);
?>
$cars=array
(
"Volvo"=>array
(
"XC60",
"XC90"
),
"BMW"=>array
(
"X3",
"X5"
),
"Toyota"=>array
(
"Highlander"
)
);
echo "Normal count: " . sizeof($cars)."<br>";
echo "Recursive count: " . sizeof($cars,1);
?>
点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html
Hadoop in Action
Chuck Lam / Manning Publications / 2010-12-22 / USD 44.99
HIGHLIGHT Hadoop in Action is an example-rich tutorial that shows developers how to implement data-intensive distributed computing using Hadoop and the Map- Reduce framework. DESCRIPTION Hadoop i......一起来看看 《Hadoop in Action》 这本书的介绍吧!
SHA 加密
SHA 加密工具
HEX CMYK 转换工具
HEX CMYK 互转工具