PHP ksort


Back to php.


moderator    (2008-08-02)

moderator

PHP ksort

Definition and Usage

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

Syntax

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

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


The output of the code above will be:

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


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

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

A nice way to do sorting of a key on a multi-dimensional array...
here 2 functions to ksort/uksort an array and all its member arrays...

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

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

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

A nice way to do sorting of a key on a multi-dimensional array...
here 2 functions to ksort/uksort an array and all its member arrays...

 PHP :: *
bigresource

after I fill the fields with the names of the users and count the...

 PHP: * - Manual
php.off > manual/sk/function.ksort.

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

 PHP: * - Manual
php.virginmedia > manual/en/function.ksort.

here 2 functions to ksort/uksort an array and all its member arrays...
A real quick way to do a case-insensitive sort of an array keyed by...

 PHP: * - Manual
php.nusa.net > manual/en/function.ksort.

 web3.net - PHP / *
web3 > gb/de/manuals

 PHP: * - Manual
br.php > ksort

A nice way to do sorting of a key on a multi-dimensional array...
here 2 functions to ksort/uksort an array and all its member arrays...
A real quick way to do a case-insensitive sort of an array keyed by...

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

 PHP : * - Sort an array by key
thaicreate

You may modify the behavior of the sort using the optional...

 [wp-cvs] wordpress/wp-admin menu.php, 1.27, 1.28 templates.php, 1.25, 1.26 theme-editor.php, 1.2, 1.3 wp-admin.css, 1.64, 1.65
comox.textdrive > pipermail/cvs/2004 September/000449

 Icemelon -- PHP, CSS, Javascript Tutorials, & More!
icemelon

 PHP : Function Reference : Array Functions : * PHP Examples Tutorials References
navioo

Using uksort() to Sort an Associative Array by the Length of Its...

 PHP Manual: *
nusphere > kb

 Easy Urpmi
easyurpmi.zarb > svn/tags/v0 4 4 4/urpmi.setup/www/urpmiweb.

provides the official security and bug fix updates - only these two...
is a devel (cutting-edge, unstable), don't use it unless you're sure...

 BB FORUM - Powered by X M B 1.8 Partagum Final SP1
billybussey > forum/viewthread.

im sorting an array by keys, but if i have 10 or higher it displays...

 // Tool to compare two language versions and merge the better translation in one file // // Just copy the version to merge in this fo...
cvs.moodle > contrib/old/compuproggy/merger.

 [#ZF-5883] Headlink.php line 310 * throws error - Zend Framework Issue Tracker
framework.zend > issues/browse/ZF 5883

2, Will the website documentation change to say...
3, Will there be no backwards compatibility legacy...

 Interactive PHP Shell (a la Python) | Web Hosting Blog - Lusion Technologies - South Africa
lusion > blog/2008/06/07/interactive

 Array Key sort by *
plus2net

function we can sort the array based on the key order and at the...
Submit your email address and receive article and product...

 Wordpress Hooks & Filters Flow
planetozh > download/plugins/wp hooks filters flow.txt

 WeberDev.com -> PHP Manual -> Sort an array by key
weberdev > Manuals

You may modify the behavior of the sort using the optional...

 Trie un tableau suivant les clés
les da silva > doc

e vb → suivre adj [jour, semaine] next, following le jour...
Nous illustrons le métamodèle et le modèle de tissage en...
Follow the links below to learn more about Martinism and the...

 ire_once('admin.php'); $themes = get_themes(); $ct = current_theme_info(); $allowed_themes = apply_filters("allowed_themes", get_site_allowed_themes(...
svn.automattic > wordpress mu/tags/2.6/wp admin/themes.

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

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

 Multi-dimensional array * loop - PHP - Snipplr
snipplr > view/14328/multidimensional array ksort loop

 Side-B » Blog Archive » PHP: *
side b.sto > weblog/archives/201

 Problēma ar * ().. - php.lv forumi
php > f/index.



Response  
 

Guest name   (option)     Register
Please sum : 280 + two  




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.