Syntax:void public DsPriorityQueue::push ($value, $priority)
Parameters :This function takes two parameters:
- $value : This is the value that will be inserted into the PriorityQueue.
- $priority : This parameter is the priority according to which the value will be ordered in the PriorityQueue.
Return Value:This function does not return any value.The following program illustrates the
Ds / PriorityQueue::push()function in PHP:
// Declare a new PriorityQueue
$pq
=
new
DsPrior ityQueue();
// Add items to PriorityQueue
$pq
-> push (
"One"
, 1);
$pq
-> push (
"Two"
, 2);
$pq
-> push (
"Three"
, 3);
echo
" PriorityQueue is: "
;
print_r (
$pq
);
Exit:PriorityQueue is: DsPriorityQueue Object ([0] = > Three [1] = > Two [2] = > One)
Link: http://php.net/manual/en/ds-priorityqueue.push.php