PHP Classes

File: example.php4

Recommend this page to a friend!
  Classes of Michal Golebiowski   FIFO Queue   example.php4   Download  
File: example.php4
Role: Example script
Content type: text/plain
Description: An example of using queue class for PHP 4
Class: FIFO Queue
Implementation of FIFO (First In First Out) queue
Author: By
Last change: changed new test to new ItemTest
Date: 20 years ago
Size: 512 bytes
 

Contents

Class file image Download
<?php
/**
* Example of using queue for PHP 4
*/

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

// Test item queue class
class ItemTest
{
  var
$id = 0;
 
  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>";
}
?>