note 34080 added to function.sort

From: Date: Tue, 15 Jul 2003 19:16:16 +0000
Subject: note 34080 added to function.sort
Groups: php.notes 
Request: Send a blank email to php-notes+get-52149@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/function.sort.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34080 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34080&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34080&report=yes

« previous php.notes (#52149) next »