pht\Queue::frontReturns the first value from a queue 説明
public mixed pht\Queue::front
( void
)
This method will remove a value from the front of the queue (in constant time). Attempting to return the front value from an empty queue will result in an Error exception. 警告
Due to the fact that all values in a pht\Queue are serialised, extracting a value from the queue will require it to be deserialised. This can incur a noticeable performance hit if the inspection of the queue's front value is performed within a loop. パラメータこの関数にはパラメータはありません。 戻り値The value on the front of the queue. 例
例1 Retrieving the front value of a queue
<?php 上の例の出力は以下となります。 int(1)
例2 Retrieving the front value in a loop (bad example - don't do this)
<?php
例3 Retrieving the front value in a loop (good example)
<?php |