Location: PHPKode > scripts > FIFO Queue > fifo-queue/example.php5
<?php
/**
* Example of using queue for PHP 5
*/

// Include queue class
require_once( 'queue.class.php5' );

// Test item queue class
class ItemTest
{
  public $id = 0;
  
  public function __construct( $id )
  {
    $this->id = $id;
  }
}

$objQueue = new Queue;

// Adding some items to queue
for ( $i = 1; $i <= 15; $i ++ )
{
  $objQueue->Put( new ItemTest( $i ) );
}

// Geting items from queue and printing them
while ( $result = $objQueue->Get() )
{
  print $result->id."<br>";
}
?>
Return current item: FIFO Queue