PHP sort


Back to php.


moderator    (2008-08-02)

moderator

PHP sort

Definition and Usage

The sort() function sorts an array by the values. This function assigns new keys for the elements in the array. Existing keys will be removed. This function returns TRUE on success, or FALSE on failure.

Syntax

sort(array,sorttype)

array : Required. Specifies the array to sort

sorttype : Optional. Specifies how to sort the array values. Possible values:

* SORT_REGULAR - Default. Treat values as they are (don't change types)
* SORT_NUMERIC - Treat values numerically
* SORT_STRING - Treat values as strings
* SORT_LOCALE_STRING - Treat values as strings, based on local settings


<?php
$my_array = array("a" => "Hamburger", "b" => "Cheese", "c" => "Jam");

sort($my_array);
print_r($my_array);
?>


The output of the code above will be:

Array
(
[0] => Cheese
[1] => Hamburger
[2] => Jam
)



See also


ficgs
More websites

You must register to see these links, as this is a collaborative page, then you may change the order of the links by clicking the icons before the titles.



admin
Other websites

The following links might be less relevant, please change their ranks if you find them useful.


 Handy PHP - Array * By Day
handyphp > index.

 InterfaceLIFT: ShapeShifter Mac OS X Themes (by date)
interfacelift > themes mac

  * Class ( * , * array, array * ) - PHP Classes
phpclasses > browse/package/4868

 PCI Vendor and Device Lists
pcidatabase > vendors.

Kontron Modular Computers GmbH (PEP Modular Computers...
Oxford Semiconductor Ltd - now part of PLX Technology...

 Download * Class 0.8 - This PHP class can be used to * array data using several types of * ing algorithms. - Softpedia
webscripts.softpedia > script

  * ing 2D-arrays in PHP - anectodes and reflections | ProDevTips - dev notes and tutorials
prodevtips > 2008/01/06/sorting 2d arrays in

ProDevTips: Sorting 2D-arrays in PHP - anectodes and...
The below 2D sorting stuff has been superseded by the sorting...

  * Class | freshmeat.net
freshmeat > projects/sortclass

 WordPress › Support » how to get search.php to * results by category
wordpress > support/topic/221314

 The Prime Glossary: sieve of Eratosthenes
primes.utm > glossary/page.

This algorithm can be written in pseudo-code as follows...
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26...

 W5YI : Products Catalog
w5yi > catalog.

Study all of the written ham exams at your PC and let your computer...
Gordon West Extra Class Study Manual includes bonus “On The...

 The LiveCD List
livecdlist

 PHP - setting * order with an associative array
wellho > mouth/603

Virtual Hosting with Apache http server - an overall scheme, and...
Setting up individual variables, and arrays, in Java - some commented...
C++ - a complete example with polymorphism, and how to split it into...

 PhpDig.net - PHP - *
phpdig > ref/rn03re57

and is designed to provide information about the PHP programming...

 Javascript equivalent for PHP's *
kevin.vanzonneveld > techblog/article/javascript equivalent for

 userlist.php & "User list * order" markup weirdness (Page 1) - PunBB 1.3 additions - PunBB Forums
punbb.informer > forums/topic/21393/userlist

 Thread Detail Page
techrepublic.com > 5208 9592 0.html?forumID=88&threadID=197240

 PHPXRef 0.7 : Mambo 4.6.5 : Detail view of * .action.php
mambo developer > api/administrator/components/com languages/actions/sort.action

 PHP dollar value * error [Archive] - CodingForums.com
codingforums > archive/index.

If I recall correctly, you can just change the data type of the field...

 PHP and SQL- * ing data in a table dynamically : php, * , table, sql
experts exchange > Web Development/Web Languages Standards

e' border='1' width='800' height='0' bordercolorlight='#fff'...
Subscribe now for full access to Experts Exchange and...
All Experts Exchange premium technology solutions are available to...

  * ing an Array in PHP | Fatboys | * , array, alphabetically, numerically, ascending, descending, narray, $narray, associative,ar * , kr * ,arsor...
fatboys > content/view/70/1

Would it be a TOTALLY DUMBASS thing if one signs an iphone contract...
Now and then you need to sort your arrays alphabetically or...

 Using * Function in PHP
akifkardas > 2008/05/08/using sort function in

 latesttopics.php error on * by "rating" - vBadvanced Forums
vbadvanced > forum/showthread.

Please note that vBadvanced is in no way affiliated with Jelsoft...

 Mantis " * " PHP Code Execution Vulnerability - Secunia Advisories - Vulnerability Information - Secunia.com
secunia > advisories/32314

Dell OpenManage IT Assistant detectIESettingsForI TA ActiveX Control...
Hitachi JP1/Performance Management Web Console Cross-Site Scripting...
Ferdows CMS Pro Cross-Site Scripting and SQL Injection...

 Threebyte » Strand * presented in PHP
threebyte > 2008/07/30/strand sort presented in

 my first shot at my own php ( * of)... making a poll [Archive] - Mac Forums
forums.macrumors > archive/index.

Originally posted by brianellisrules Hey, thanks for the...

 WBAI Archives and Podcasts
archive.wbai > index.

Poet/performance artist Todd Shalom on upcoming walks of Elastic...
Three topics: (1) 777 School Employees, The Majority School Aides,...
Scott Sommer was joined by George Albro from the Association of...

 UMPC, Netbook and MID comparison, details and specifications website.
umpcportal > products/index.

 [#CONTRIB-440] * out ajax.php and how it deals with quiz groups - Moodle Tracker
tracker.moodle > browse/CONTRIB 440



Response  
 

Guest name   (option)     Register
Please sum : 927 + three  




Trackbacks : If you talked about this article in your blog or website, you may instantly get a backlink 
There's no trackback at the moment.