Like this code?
Show the author your appreciation.
The queue class I fixed up in a few minute, there are a comparison between my class and the native way of implementing it.
My Queue class
<?php
class queue {
var $q ;
var $p = 0 ;
function enqueue ( $stuff = null ){
$this -> q []= $stuff ;
}
function dequeue (){
$a = $this -> q [ $this -> p ];
unset( $this -> q [ $this -> p ++]);
return $a ;
}
}
?>
Usage Example
<?php
$queue = new queue ;
//add things to queue
$queue -> enqueue ( 'stuff' );
//take things out
$queue -> dequeue ();
?>
It is much faster on taking things out than the native verion
<?php
$queue = array();
//add something in the queue
$queue [] = 'stuff' ;
//take something out
array_shift ( $queue );
?>
Compare two texts and display a block of text with the differences between them. Categories : PHP , PHP Classes , Filesystem , Strings , Arrays XML To Array Categories : PHP , PHP Classes , XML , Arrays Tweak Array, insert/add elements to any position of your arrays - delete elements from your arrays - move elements within your arrays - replace elements from your arrays ... the array, 'dynamically' grows or shrinks to whatever we tweak it. Categories : PHP Classes , Arrays , PHP A class to put get and post variables in hidden form
elements. Works on scalars, normal arrays, associative
arrays. Categories : Algorithms , Variables , Arrays , PHP , PHP Classes Array Insertion Categories : PHP , PHP Classes , Arrays PHPDRAW, the php wannabe Photoshop ;-) Categories : PHP , PHP Classes , GD image library , Arrays HTML_Graphs uses PHP to provide a consistent interface for creating HTML based charts. The user of the class sets up arrays that are passed to html_graph() which then takes care of all the messy HTML layout. Categories : Graphics , Arrays , PHP , PHP Classes , Charts and Graphs Sort the results from a SELECT query (any number of columns) into an array automatically. Categories : PHP , PHP Classes , Arrays , Databases , MySQL Function that returns an array with the 7 dates of the week that belong to the supplied date. Categories : PHP , Date Time , Arrays Filter - A simple class that lets you use multiple functions to create custom filters. Categories : PHP , PHP Classes , Strings Convert SQL from oracle,mysql,mssql,sqlite and odbc to SQL compatible Categories : PHP , PHP Classes , Databases , MySQL , MS SQL Server Human readable PHP password generator Categories : PHP , Security , Beginner Guides , Arrays Email Class Categories : PHP , Mail , PHP Classes Random text quote Categories : PHP , Arrays , Beginner Guides DbObject - A PHP wrapper for working with various databases Categories : Databases , PHP , PHP Classes