reference/dir/functions/scandir.xml
3f63f2b26300dd0c15d5635b8053e67448076146
...
...
@@ -9,10 +9,10 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>array</type><methodname>scandir</methodname>
12
+
<type class="union"><type>array</type><type>false</type></type><methodname>scandir</methodname>
13
13
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
14
-
<methodparam choice="opt"><type>int</type><parameter>sorting_order</parameter><initializer>SCANDIR_SORT_ASCENDING</initializer></methodparam>
15
-
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
14
+
<methodparam choice="opt"><type>int</type><parameter>sorting_order</parameter><initializer><constant>SCANDIR_SORT_ASCENDING</constant></initializer></methodparam>
15
+
<methodparam choice="opt"><type class="union"><type>resource</type><type>null</type></type><parameter>context</parameter><initializer>&null;</initializer></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
18
Returns an <type>array</type> of files and directories from the
...
...
@@ -71,29 +71,27 @@
71
71

72
72
<refsect1 role="changelog">
73
73
&reftitle.changelog;
74
-
<para>
75
-
<informaltable>
76
-
<tgroup cols="2">
77
-
<thead>
78
-
<row>
79
-
<entry>&Version;</entry>
80
-
<entry>&Description;</entry>
81
-
</row>
82
-
</thead>
83
-
<tbody>
84
-
<row>
85
-
<entry>5.4.0</entry>
86
-
<entry>
87
-
<parameter>sorting_order</parameter> now accepts constants. Any
88
-
nonzero value caused descending order in previous versions.
89
-
</entry>
90
-
</row>
91
-
</tbody>
92
-
</tgroup>
93
-
</informaltable>
94
-
</para>
74
+
<informaltable>
75
+
<tgroup cols="2">
76
+
<thead>
77
+
<row>
78
+
<entry>&Version;</entry>
79
+
<entry>&Description;</entry>
80
+
</row>
81
+
</thead>
82
+
<tbody>
83
+
<row>
84
+
<entry>8.0.0</entry>
85
+
<entry>
86
+
<parameter>context</parameter> is now nullable.
87
+
</entry>
88
+
</row>
89
+
</tbody>
90
+
</tgroup>
91
+
</informaltable>
95
92
</refsect1>
96
93

94
+

97
95
<refsect1 role="examples">
98
96
&reftitle.examples;
99
97
<para>
...
...
@@ -104,7 +102,7 @@
104
102
<?php
105
103
$dir = '/tmp';
106
104
$files1 = scandir($dir);
107
-
$files2 = scandir($dir, 1);
105
+
$files2 = scandir($dir, SCANDIR_SORT_DESCENDING);
108
106

109
107
print_r($files1);
110
108
print_r($files2);
...
...
@@ -134,52 +132,6 @@ Array
134
132
</screen>
135
133
</example>
136
134
</para>
137
-
<para>
138
-
<example>
139
-
<title>PHP 4 alternatives to <function>scandir</function></title>
140
-
<programlisting role="php">
141
-
<![CDATA[
142
-
<?php
143
-
$dir = "/tmp";
144
-
$dh = opendir($dir);
145
-
while (false !== ($filename = readdir($dh))) {
146
-
$files[] = $filename;
147
-
}
148
-

149
-
sort($files);
150
-

151
-
print_r($files);
152
-

153
-
rsort($files);
154
-

155
-
print_r($files);
156
-

157
-
?>
158
-
]]>
159
-
</programlisting>
160
-
&example.outputs.similar;
161
-
<screen>
162
-
<![CDATA[
163
-
Array
164
-
(
165
-
[0] => .
166
-
[1] => ..
167
-
[2] => bar.php
168
-
[3] => foo.txt
169
-
[4] => somedir
170
-
)
171
-
Array
172
-
(
173
-
[0] => somedir
174
-
[1] => foo.txt
175
-
[2] => bar.php
176
-
[3] => ..
177
-
[4] => .
178
-
)
179
-
]]>
180
-
</screen>
181
-
</example>
182
-
</para>
183
135
</refsect1>
184
136

185
137
<refsect1 role="notes">
...
...
@@ -200,7 +152,6 @@ Array
200
152
</para>
201
153
</refsect1>
202
154
</refentry>
203
-

204
155
<!-- Keep this comment at the end of the file
205
156
Local variables:
206
157
mode: sgml
207
158