자료구조 Ds\PriorityQueue::push
(PECL ds >= 1.0.0)
Ds\PriorityQueue::push — 큐에 값을 푸시합니다.
설명
public Ds\PriorityQueue::push(mixed $value
, int $priority
): void
지정된 priority
의 value
을 큐에 푸시합니다.
매개변수
value
- 큐에 푸시할 값입니다.
priority
- 값과 관련된 우선 순위입니다.
반환 값
값이 반환되지 않습니다.
Examples
예제 #1 Ds\PriorityQueue::push() 예제
<?php
$queue = new \Ds\PriorityQueue();
$queue->push("a", 5);
$queue->push("b", 15);
$queue->push("c", 10);
print_r($queue->pop());
print_r($queue->pop());
print_r($queue->pop());
?>
위의 예는 다음과 유사한 결과를 출력합니다.
string(1) "b" string(1) "c" string(1) "a"