The Queue::isEmpty()
function in PHP is used to check if a queue is empty. Queue::isEmpty()
returns true
(1
) if the queue is empty. Otherwise, it returns false
.
The illustration below shows the visual representation of the Queue::isEmpty()
function.
queue_name->isEmpty()
## where the queue_name is the name of the queue
The Queue::isEmpty()
function does not require any parameters.
The Queue::isEmpty()
function returns true
(1
) if the queue is empty. Otherwise, it returns false
.
<?php$queue1 = new \Ds\Queue();#sending the list of elements$queue->push(1,3,5,2,0);echo("Queue1 is empty");echo($queue1->isEmpty());######output#######Queue1 is empty :$queue2 = new \Ds\Queue();echo("Queue2 is empty");echo($queue2->isEmpty());######output#######Queue2 is empty: 1?>