• PHP Video Tutorials

PHP - Ds\PriorityQueue::allocate() Function



Ds\PriorityQueue::allocate() function can allocate enough memory for the required capacity.

Syntax

public void Ds\PriorityQueue::allocate( int $capacity )

Ds\PriorityQueue::allocate() function can ensure that enough memory is allocated for the required capacity. It can remove the need to reallocate internal as values are added.

Ds\PriorityQueue::allocate() function doesn't return any value.

Example

<?php  
   $pqueue = new \Ds\PriorityQueue();  
  
   echo("The allocated space is:");  
   var_dump($pqueue->capacity());  
   echo("The allocated space is:");  
  
   $pqueue->allocate(10);  
   var_dump($pqueue->capacity());  
  
   $pqueue->allocate(80);  
   var_dump($pqueue->capacity());  
?>
php_function_reference.htm
Advertisements