PHP Ds Deque capacity()函数
Ds\Deque::capacity() 函数返回当前容量。
语法
public int Ds\Deque::capacity( void )
Ds\Deque::capacity()函数没有任何参数,可以返回当前容量。
示例1
<?php
deque = new \Ds\Deque(); echo(" The default size of deque:"); var_dump(deque->capacity());
deque->allocate(30); echo("The allocated size of deque:"); var_dump(deque->capacity());
?>
示例2
<?php
deque = new \Ds\Deque([1, 2, 3, 4, 5, 6]); echo("The elements of deque:"); var_dump(deque);
echo("\n The capacity of a deque:");
var_dump($deque->capacity());
?>