Change example to something different than krsort()

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@210690 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jakub Vrana 2006-04-05 08:28:14 +00:00
parent bd08c45d79
commit caec5e0640

View file

@ -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 @@ foreach ($a as $key => $value) {
&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>