此函式沒有參數。
一個包含所有值的 陣列,順序與佇列相同。
範例 #1 Ds\PriorityQueue::toArray() 範例
<?php
$queue = new \Ds\PriorityQueue();
$queue->push("a", 5);
$queue->push("b", 15);
$queue->push("c", 10);
var_dump($queue->toArray());
?>
上述範例的輸出結果類似於
array(3) { [0]=> string(1) "b" [1]=> string(1) "c" [2]=> string(1) "a" }