PHP asort


Back to php.


moderator    (2008-08-02)

moderator

PHP asort

Definition and Usage

The asort() function sorts an array by the values. The values keep their original keys. This function returns TRUE on success, or FALSE on failure.

Syntax

asort(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");

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


The output of the code above will be:

Array
(
[b] => Cheese
[a] => Hamburger
[c] => 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.


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

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

 PHP: * - Manual
php.benscom > manual/ja/function.asort.

Here's one I whipped up to allow you to sort an array of a specific...
here another version from acecream multisorting for arrays :)...

 PHP: * - Manual
algorytmy > doc

zaznacz działy do przeszukania (brak wyboru = wszystkie...

 PHP: Collator:: * - Manual
php.mirror.facebook > manual/en/collator.asort.

  * () bug? [Archive] - FutureQuest Community
aota > forums/archive/index.

Looking at the complete ChangeLog, and also the bug tracking system,...
I learned to compile PHP through reading the official docs, and also...

 PHP Manual: *
nusphere > kb

 PHP: * - Manual
php.filearena > manual/kr/function.asort.

Here's one I whipped up to allow you to sort an array of a specific...
here another version from acecream multisorting for arrays :)...
I noticed that my function mentioned earlier is very misleading -...

 PHP : * - Sort an array and maintain index association
thaicreate

You may modify the behavior of the sort using the optional...
This function sorts an array such that array indices maintain...

 PHP :: " * " Is Not Doing What It Is Supposed To Do
bigresource

Is The Php Install For Xp/apache Supposed To Build The Extensions...
Is the php install for xp/apache supposed to build the extensions...

 PHP: * - Manual
bogambilya.asti.dost.gov > manual/fr/function.asort.

/*Load jQuery if not already loaded*/ if(typeof jQuery ==...

  * () 函数 - 用法|在线手册|属性|方法
fzs8

 PHP: asort
pixel.fpn > kezikonyv/function.asort.

 PHP: * - Manual - 布啦布啦 BlaBla.cn
blabla > z

 PEAR NEWS :: Manuals :: PHP :: *
pear news > manuals

 JavaScript * - PHP.JS
phpjs > functions/asort:354

IE does preserve the right order as it goes through the for loop,...
// compare items as strings, based on the current locale (set with...

 WikiAnswers - Difference between sort and * in php
wiki.answers > Q/Difference between sort and asort in

  * nesortuje, ale * uje :)
forum.ubuntu > index.

Proc to potrebuju: Potrebuju setridit radky ze souboru, ale jen do...
Staci dat asort dvakrat za sebou a pak je to poradi spravne jak ma...

 Sort array maintaining index association
myblog.arps

Nine US troops, dozens of rebels dead in Afghanistan -...
Improve Your Google AdSense Ad Relevancy with Section...

 WeberDev.com -> PHP Manual -> Sort an array and maintain index association
weberdev > Manuals

You may modify the behavior of the sort using the optional...
This function sorts an array such that array indices maintain...

 Variables and Constants in PHP
services.exeter.ac > cmit/modules/programming/webct/ch05

...But the main advantage of using an array rather than simple...
Next add some HTML markup to turn it into a proper...

 PHP Blog » *
vaziliy > blog/?tag=asort

 PHP特化型検索エンジン
zuzara > pub/y

 Help -- SELECT Function PHP Script - WebProWorld
webproworld > web programming discussion forum/69491 help select function

 PHP - * - Array-Funktionen
selfphp > funktionsreferenz/array funktionen/asort.

Wie latenz bist Du wirklich? Jetzt herausfinden auf unseren sexy...
? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ ] ^ _...

 PHP 基礎編8 - 配列操作、sort、 * 、ksort、array_push、array_shift - SAK Streets
homepage2.nifty > sak/w sak3/doc/sysbrd

 Manuel PHP - * - La référence en Cours et Manuels PHP / MYSQL / HTML en francais
manuelphp

 PHP syntax: sort an associative array by value with * | PHP programming | Tech-Recipes
tech recipes > rx/299

Solve PHP error: Cannot modify header information - headers already...
Android: Use Visual Task Switcher to Easily View Running...

 HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> * PHP ManualPrevNext * (PHP 3, PHP 4 , PHP 5) * -- Sort an array and maint...
thai programmer > master

 STUDIO WING .lib: PHP: * ()関数・arsort()関数
lib.stwing > archives/2005/11

asort()関数:配列を値で昇順にソートします。...



Response  
 

Guest name   (option)     Register
Please sum : 3763 + nine  




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.