PHP Ds Deque pop() 函数
Ds\Deque::pop() 函数可以移除并返回最后一个值。
语法
public mixed Ds\Deque::pop( void )
Ds\Deque::pop()函数没有任何参数。
Ds\Deque::pop()函数可以返回移除的最后一个值,并在空时抛出UnderflowException异常。
示例1
<?php
deque = new \Ds\Deque([10, 20, 30, 40, 50]); echo("The elements in deque: \n"); print_r(deque);
echo("\n The last element in deque:");
print_r(deque->pop());
echo("\n The elements in deque: \n"); print_r(deque);
?>
示例2
<?php
deque = new \Ds\Deque(["Tutorials", "Point", "India", "Tutorix"]); echo("The elements in deque: \n"); print_r(deque);
echo("\n The last element in deque:");
print_r(deque->pop());
echo("\n The elements in deque: \n"); print_r(deque);
?>