WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Queue class VS Native array
Categories : PHP, PHP Classes, Arrays Click here to Update Your Picture
Chao Xu
Date : May 15th 2007
Grade : Be the 1st to grade this Code Example
Viewed : 3141
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Chao Xu
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
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