PHP Ds Deque count()函数
Ds\Deque::count()函数可以用于获取Deque中元素的数量。
语法
public Ds\Deque::count( void ) : int
Ds\Deque::count()函数没有任何参数。该函数返回Deque中的元素数量。
示例1
<?php
deque = new \Ds\Deque([1, 2, 3, 4, 5]); echo("The elements in the deque: \n"); print_r(deque);
echo("\n The number of elements in the deque: ");
print_r($deque->count());
?>
示例2
<?php
deque = new \Ds\Deque(["Tutorials", "Point", "Tutorix"]); echo("The elements in the deque: \n"); print_r(deque);
echo("\n The number of elements in the deque: ");
print_r($deque->count());
?>