|
|
|
|
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);
?> | | |
|
| XML To Array Categories : PHP, PHP Classes, XML, Arrays | | | PHPDRAW, the php wannabe Photoshop ;-) Categories : PHP, PHP Classes, GD image library, Arrays | | | Compare two texts and display a block of text with the differences between them. Categories : PHP, PHP Classes, Filesystem, Strings, Arrays | | | 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 | | | 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 | | | 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 | | | Sort the results from a SELECT query (any number of columns) into an array automatically. Categories : PHP, PHP Classes, Arrays, Databases, MySQL | | | Simple class that uses GD to draw pie charts. After the class definition there's some sample code to demonstrate how you use the class.
Categories : Graphics, PHP, PHP Classes, GD image library, Charts and Graphs | | | PHP Script to find url links in a page Categories : PHP, URLs, Regexps, Arrays | | | PHP4 DirectoryIterator Class Categories : PHP, PHP Classes, Filesystem, Directories | | | Class to build a select tag in html, useful to build select boxes from a data base Categories : PHP, HTML and PHP, PHP Classes | | | Email Class Categories : PHP, Mail, PHP Classes | | | Customizable Calendar Class Categories : HTML and PHP, Date Time, PHP, PHP Classes, Calendar | | | [PHP5] NOTIMEOUT PACKAGE Categories : PHP, PHP Classes, AJAX | |
|
|
|