reference/array/functions/ksort.xml
2ca090342977839edca2f7f4e52305a1b5da6095
...
...
@@ -8,15 +8,18 @@
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
-
<type>bool</type><methodname>ksort</methodname>
11
+
<type>true</type><methodname>ksort</methodname>
12
12
<methodparam><type>array</type><parameter role="reference">array</parameter></methodparam>
13
13
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer><constant>SORT_REGULAR</constant></initializer></methodparam>
14
14
</methodsynopsis>
15
15
<para>
16
-
Sorts an array by key in ascending order, maintaining key to data correlations. This is
17
-
useful mainly for associative arrays.
16
+
Sorts <parameter>array</parameter> in place by keys
17
+
in ascending order.
18
18
</para>
19
+
&note.sort-unstable;
20
+
&note.reset-index;
19
21
</refsect1>
22
+

20
23
<refsect1 role="parameters">
21
24
&reftitle.parameters;
22
25
<para>
...
...
@@ -33,12 +36,33 @@
33
36
</variablelist>
34
37
</para>
35
38
</refsect1>
39
+

36
40
<refsect1 role="returnvalues">
37
41
&reftitle.returnvalues;
38
42
<para>
39
-
&return.success;
43
+
&return.true.always;
40
44
</para>
41
45
</refsect1>
46
+

47
+
<refsect1 role="changelog">
48
+
&reftitle.changelog;
49
+
<para>
50
+
<informaltable>
51
+
<tgroup cols="2">
52
+
<thead>
53
+
<row>
54
+
<entry>&Version;</entry>
55
+
<entry>&Description;</entry>
56
+
</row>
57
+
</thead>
58
+
<tbody>
59
+
&return.type.true;
60
+
</tbody>
61
+
</tgroup>
62
+
</informaltable>
63
+
</para>
64
+
</refsect1>
65
+

42
66
<refsect1 role="examples">
43
67
&reftitle.examples;
44
68
<para>
...
...
@@ -66,16 +90,54 @@ d = lemon
66
90
</screen>
67
91
</example>
68
92
</para>
93
+

94
+
<para>
95
+
<example>
96
+
<title><function>ksort</function> with <type>int</type> keys</title>
97
+
<programlisting role="php">
98
+
<![CDATA[
99
+
<?php
100
+
$a = [0 => 'First', 2 => 'Last', 1 => 'Middle'];
101
+
var_dump($a);
102
+
ksort($a);
103
+
var_dump($a);
104
+
?>
105
+
]]>
106
+
</programlisting>
107
+
&example.outputs;
108
+
<screen>
109
+
<![CDATA[
110
+
array(3) {
111
+
[0]=>
112
+
string(5) "First"
113
+
[2]=>
114
+
string(4) "Last"
115
+
[1]=>
116
+
string(6) "Middle"
117
+
}
118
+
array(3) {
119
+
[0]=>
120
+
string(5) "First"
121
+
[1]=>
122
+
string(6) "Middle"
123
+
[2]=>
124
+
string(4) "Last"
125
+
}
126
+
]]>
127
+
</screen>
128
+
</example>
129
+
</para>
69
130
</refsect1>
131
+

70
132
<refsect1 role="seealso">
71
133
&reftitle.seealso;
72
-
<para>
73
-
<simplelist>
74
-
<member><function>asort</function></member>
75
-
<member>&seealso.array.sorting;</member>
76
-
</simplelist>
77
-
</para>
134
+
<simplelist>
135
+
<member><function>sort</function></member>
136
+
<member><function>krsort</function></member>
137
+
<member>&seealso.array.sorting;</member>
138
+
</simplelist>
78
139
</refsect1>
140
+

79
141
</refentry>
80
142
<!-- Keep this comment at the end of the file
81
143
Local variables:
82
144