vrana Wed Apr 5 08:28:14 2006 UTC
Modified files: /phpdoc/en/reference/array/functions uksort.xml Log: Change example to something different than krsort() http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/array/functions/uksort.xml?r1=1.17&r2=1.18&diff_format=u Index: phpdoc/en/reference/array/functions/uksort.xml diff -u phpdoc/en/reference/array/functions/uksort.xml:1.17 phpdoc/en/reference/array/functions/uksort.xml:1.18 --- phpdoc/en/reference/array/functions/uksort.xml:1.17 Mon Apr 3 15:04:09 2006 +++ phpdoc/en/reference/array/functions/uksort.xml Wed Apr 5 08:28:14 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.17 $ --> +<!-- $Revision: 1.18 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.uksort"> <refnamediv> @@ -40,13 +40,12 @@ <?php function cmp($a, $b) { - if ($a == $b) { - return 0; - } - return ($a > $b) ? 1 : -1; + $a = ereg_replace('^(a|an|the) ', '', $a); + $b = ereg_replace('^(a|an|the) ', '', $b); + return strcasecmp($a, $b); } -$a = array(4 => "four", 3 => "three", 20 => "twenty", 10 => "ten"); +$a = array("John" => 1, "the Earth" => 2, "an apple" => 3, "a banana" => 4); uksort($a, "cmp"); @@ -59,10 +58,10 @@ &example.outputs; <screen> <![CDATA[ -20: twenty -10: ten -4: four -3: three +an apple: 3 +a banana: 4 +the Earth: 2 +John: 1 ]]> </screen> </example>