include("class_queue.php");
?>
Class Queue Examples
// Example 1 of the queue class, this is a full example of how to use the class
$queue_a = new Queue(1);
$queue_a->setQueueTable("queue");
$queue_a->setTimeout(1);
$queue_a->getInQueue();
if ($queue_a->waitInLine() == true)
{
// When the user gets to the first in line
echo "You have got to the first position in the queue.
";
$qtime = $queue_a->queueTime();
echo "You were in the queue for {$qtime} seconds.
";
}
else
{
// If some is wrong, user times-out
echo "You have been kick-out of the queue!";
}
$queue_a->getOutOfQueue();
//========================================================================================
// This is to show that you have have more than 1 queue on the same page
$queue_b = new Queue(2);
$queue_b->getInQueue();
$q_return = $queue_a->waitInLine();
if ($q_return == true)
{
// Do some function
}
$queue_b->getOutOfQueue();
?>