Ds\Queue::pop() 函數可以刪除並返回隊列前麵的值。
用法
public mixed Ds\Queue::pop( void )
Ds\Queue::pop() 函數沒有任何參數。
Ds\Queue::pop() 函數可以返回位於隊列前麵的刪除值。如果為空,此函數可以拋出 UnderflowException。
示例
<?php
$queue = new \Ds\Queue();
$queue->push("Tutorials");
$queue->push("Point");
$queue->push("India");
echo "The initial queue is:\n";
print_r($queue);
echo "\n The popped element is:";
print_r($queue->pop());
echo "\n The final queue is:\n";
print_r($queue);
?>
相關用法
- PHP Ds\Queue::push()用法及代碼示例
- PHP Ds\Queue::peek()用法及代碼示例
- PHP Ds\Queue::allocate()用法及代碼示例
- PHP Ds\Queue::capacity()用法及代碼示例
- PHP Ds\Queue pop()用法及代碼示例
- PHP Ds\Queue push()用法及代碼示例
- PHP Ds\Queue clear()用法及代碼示例
- PHP Ds\Queue capacity()用法及代碼示例
- PHP Ds\Queue count()用法及代碼示例
- PHP Ds\Queue copy()用法及代碼示例
- PHP Ds\Queue isEmpty()用法及代碼示例
- PHP Ds\Queue allocate()用法及代碼示例
- PHP Ds\Queue toArray()用法及代碼示例
- PHP Ds\Queue peek()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP - Ds\Queue::pop() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。