The Ds\PriorityQueue::count() Function in PHP is used to get the count of elements present in a Priority Queue instance.
Syntax:
int public Ds\PriorityQueue::count( void )
Parameters: This function does not accepts any parameters.
Return Value: This function calculates the number of elements present in a Priority Queue instance and returns the count.
Below programs illustrate the Ds\PriorityQueue::count() Function in PHP:
Program 1:
PHP
<?php
$pq = new \Ds\PriorityQueue();
$pq ->push( "One" , 1);
$pq ->push( "Two" , 2);
$pq ->push( "Three" , 3);
print_r( $pq -> count ());
?>
|
Program 2:
PHP
<?php
$pq = new \Ds\PriorityQueue();
$pq ->push( "Geeks" , 1);
$pq ->push( "for" , 2);
$pq ->push( "Geeks" , 3);
print_r( $pq -> count ());
?>
|
Reference: http://php.net/manual/en/ds-priorityqueue.count.php