WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
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 Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
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
Submit Site
Forex Trading Online forex trading platform

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 : quick sort for associative arrays
Categories : Algorithms, Arrays, PHP Update Picture
David Sklar
Date : Jan 16th 1999
Grade : 3 of 5 (graded 2 times)
Viewed : 7807
File : No file for this code example.
Images : No Images for this code example.
Search : More code by David Sklar
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?

function qsort($a,$f) {
qsort_do(&$a,0,Count($a)-1,$f);
}

function qsort_do($a,$l,$r,$f) {
if ($l < $r) {
qsort_partition(&$a,$l,$r,&$lp,&$rp,$f);
qsort_do(&$a,$l,$lp,$f);
qsort_do(&$a,$rp,$r,$f);
}
}

function qsort_partition($a,$l,$r,$lp,$rp,$f) {
$i = $l+1;
$j = $l+1;

while ($j <= $r) {
if ($f($a[$j],$a[$l])) {
$tmp = $a[$j];
$a[$j] = $a[$i];
$a[$i] = $tmp;
$i++;
}
$j++;
}

$x = $a[$l];
$a[$l] = $a[$i-1];
$a[$i-1] = $x;

$lp = $i - 2;
$rp = $i;
}

?>



A recursive function to traverse a multi-dimensional array where the dimensions are not known
Categories : Arrays, PHP, Algorithms
minus - subtract arrays. Send two arrays and get an array with the operation A-B, elements on A that are not included on B.
Categories : PHP, Arrays, Algorithms
New functions for PHP3. For those that know Perl, you will recognize a lot of these.All but one deal with array handling. Sorting, splicing, etc.
Categories : Algorithms, Arrays, PHP
A simple bubblesort that takes 2 arrays as argument.The first one is the actual data used for sorting, the second is data that will "tag along" with the first array, for instance a descriptive text about the data in the first array.
Categories : Algorithms, Arrays, PHP, Complete Programs
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
PHP Script to find url links in a page
Categories : PHP, URLs, Regexps, Arrays
Tag content retrieval from websites with preg_match
Categories : PHP, Regexps, Arrays, HTML and PHP
Array values from javascript to php
Categories : PHP, Java Script, Arrays
clearing variables in php3
Categories : Variables, Arrays, PHP
Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET
Categories : Algorithms, HTML and PHP, PHP, Variables
A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL
This functions makes it easy to use session-variables known from ASP. With one Cookie the array "session" will save and restore from a db-record. In this version MySQL is used but it's should very easy to change
Categories : PHP, Arrays, Cookies, MySQL, Databases
Weighted Random - Random Scripts usually chose one out of each item, and each item have an equal chance to be chosen. But what if you want an item to be chosed more frequently than other?
Categories : PHP, Math., Arrays
Display list of files within current and subdirectories (recursively) showing each file as an anchored link and each directory as a category header.
Categories : Filesystem, Directories, Arrays, PHP
Array Insertion
Categories : PHP, PHP Classes, Arrays