Ds\Set::count() 函数可用于计算集合中存在的值的数量,也称为集合实例的大小。
用法
public int Ds\Set::count()
Ds\Set::count() 函数没有任何参数。
Ds\Set::count() 函数可以返回集合中存在的值的数量。
例子1
<?php
$set = new \Ds\Set([10, 15, 20, 25]);
var_dump($set);
echo "The count is:";
print_r($set->count());
?>
例子2
>?php
$set = new \Ds\Set(["Tutorials", "Point", "India"]);
var_dump($set);
echo "The count is:";
print_r($set->count());
?>
相关用法
- PHP Ds Set contains()用法及代码示例
- PHP Ds Set capacity()用法及代码示例
- PHP Ds Set intersect()用法及代码示例
- PHP Ds Set remove()用法及代码示例
- PHP Ds Set toArray()用法及代码示例
- PHP Ds Set slice()用法及代码示例
- PHP Ds Set sort()用法及代码示例
- PHP Ds Set merge()用法及代码示例
- PHP Ds Set reduce()用法及代码示例
- PHP Ds Set reversed()用法及代码示例
- PHP Ds Set filter()用法及代码示例
- PHP Ds Set add()用法及代码示例
- PHP Ds Set join()用法及代码示例
注:本文由纯净天空筛选整理自 PHP - Ds Set count() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。