Syntax:array public DsPriorityQueue::toArray (void)
Parameters: this function takes no parameters.Return value:this function converts the PriorityQueue to an associative array and returns an array.The program below illustrates the function Ds / PriorityQueue::toArray()in PHP:
// Declare a new PriorityQueue
$pq
=
new
DsPriorityQueue();
// Add items to PriorityQueue
$pq
-> push (
"One"
, 1);
$pq
-> push (
"Two"
, 2);
$pq
-> push (
"Three"
, 3);
echo
" The equivalent array is: "
;
print_r (
$pq
-> toArray());
Exit:The equivalent array is: Array ([0] = > Three [1] = > Two [2] = > One)
Link: http://php.net/manual/en/ds-priorityqueue.toarray.php