• PHP Video Tutorials

PHP - Ds\PriorityQueue::toArray() Function



Ds\PriorityQueue::toArray() function can convert the queue to an array.

Syntax

public array Ds\PriorityQueue::toArray( void )

Ds\PriorityQueue::toArray() function doesn't have any parameters.

Ds\PriorityQueue::toArray() function can return an array containing all values in the same order as the queue.

Example

<?php  
   $pqueue = new \Ds\PriorityQueue();  
   
   $pqueue->push("Tutorials", 1); 
   $pqueue->push("Point", 2); 
   $pqueue->push("India", 3); 
  
   echo "The equivalent array is: \n"; 
   print_r($pqueue->toArray());
?>
php_function_reference.htm
Advertisements