CakeFest 2024: The Official CakePHP Conference

Ds\PriorityQueue::toArray

(PECL ds >= 1.0.0)

Ds\PriorityQueue::toArray Converts the queue to an Array

Beschreibung

public Ds\PriorityQueue::toArray(): array

Converts the queue to an Array.

Hinweis:

This method is not destructive.

Hinweis:

Casting to an Array is not supported yet.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

An Array containing all the values in the same order as the queue.

Beispiele

Beispiel #1 Ds\PriorityQueue::toArray() example

<?php
$queue
= new \Ds\PriorityQueue();

$queue->push("a", 5);
$queue->push("b", 15);
$queue->push("c", 10);

var_dump($queue->toArray());
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

array(3) {
  [0]=>
  string(1) "b"
  [1]=>
  string(1) "c"
  [2]=>
  string(1) "a"
}
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top