• PHP Video Tutorials

PHP - Queue Class Functions



The Queue is a “first-in, first-out” or “FIFO” collection that can only allow access to value at the front of a queue and iterate in that order destructively.

Class Synopsis

Ds\Queue implements Ds\Collection {
   /* Constants */
   const int MIN_CAPACITY = 8 ;

   /* Methods */
   public void allocate( int $capacity )
   public int capacity( void )
   public void clear( void )
   public Ds\Queue copy( void )
   public bool isEmpty( void )
   public mixed peek( void )
   public mixed pop( void )
   public void push([ mixed $...values ] )
   public array toArray( void )
}

Predefined Constants

Ds\Queue::MIN_CAPACITY

Sr.No Functions & Description
1

Ds\Queue::allocate() Function

This function can allocate enough memory for the required capacity.

2

Ds\Queue::capacity() Function

This function can return the current capacity.

3

Ds\Queue::clear() Function

This function can remove all values from a queue.

4

Ds\Queue::__construct() Function

This function can create a new instance.

5

Ds\Queue::copy() Function

This function can return the shallow copy of a queue.

6

Ds\Queue::count() Function

This unction can be used to get the count of elements present in a queue.

7

Ds\Queue::isEmpty() Function

This function can return whether the queue is empty.

8

Ds\Queue::jsonSerialize() Function

This function can return a representation that can be converted to JSON.

9

Ds\Queue::peek() Function

This function can return a value at the front of a queue.

10

Ds\Queue::pop() Function

This function can remove and return a value at the front of a queue.

11

Ds\Queue::push() Function

This function can push the values into a queue.

12

Ds\Queue::toArray() Function

This function can convert the queue to an array.

php_function_reference.htm
Advertisements