php queue example.Array queues use the linear data structure known as First-In-First-Out (FIFO). This implies that the initial item added to the queue is also the initial item removed from it.
In PHP, an array can be used to implement a queue. The order of the array places the first item added to the queue at the top and the last item added at the bottom. An item is eliminated from the array’s starting position when it is eliminated from the queue.

Here is an php queue example of how you can create a queue using an array in PHP:
class Queue
{
public $list = [], $capacity, $front = -1, $rear = -1;
public function __construct($capacity)
{
$this->capacity = $capacity;
}
public function enqueue($value)
{
if ($this->isFull()) {
echo "Maximum capacity exceed";
return;
}
$this->list[++$this->rear] = $value;
if ($this->front == -1) {
++$this->front;
}
return $this;
}
public function dequeue()
{
if ($this->isEmpty()) {
echo "Nothing to dequeue" . PHP_EOL;
return;
}
unset($this->list[$this->front++]);
return $this;
}
private function isFull()
{
return $this->capacity == count($this->list);
}
private function isEmpty()
{
return !count($this->list);
}
}
$queue = new Queue(5);
$queue->enqueue(1)
->enqueue(2)
->enqueue(3)
->enqueue(4)
->enqueue(5)
->dequeue()
->dequeue()
->dequeue()
->dequeue()->dequeue()->dequeue();
print_r($queue);