note 34080 deleted from function.sort by didou
| From: | didou@php.net | Date: | Wed, 16 Jul 2003 09:45:54 +0000 |
| Subject: | note 34080 deleted from function.sort by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-52178@lists.php.net to get a copy of this message | ||
Note Submitter:
----
The posting below was found on the sort manual page http://us4.php.net/manual/en/function.sort.php
of the php.net web site and does not work as stated:
--------------------------
shailu_agrawal at yahoo dot no_spam dot com
13-Nov-2002 05:05
if 2nd parameter is "SORT_REGULAR" it will compare characters by ASCII values.
For ex: if unsorted values are: B , a , A
with SORT_REGULAR sorted result will be: A , B , a
and with SORT_STRING sorted result will be: a , A , B
--------------------------
For example:
<?php
$sort_string = array(Z, a, z, A, b, B);
sort($sort_string, SORT_STRING);
while (list ($key, $val) = each ($sort_string)) {
echo "sort_string[".$key."] = ".$val."<br />";
}
?>
Produces the following output:
sort_string[0] = A
sort_string[1] = B
sort_string[2] = Z
sort_string[3] = a
sort_string[4] = b
sort_string[5] = z