1--TEST--
2Test readdir() function : basic functionality
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) != 'WIN') {
6  die("skip Valid only on Windows");
7}
8?>
9--FILE--
10<?php
11/* Prototype  : string readdir([resource $dir_handle])
12 * Description: Read directory entry from dir_handle
13 * Source code: ext/standard/dir.C
14 */
15
16/*
17 * Test basic functionality of readdir()
18 */
19
20echo "*** Testing readdir() : basic functionality ***\n";
21
22// include the file.inc for Function: function create_files()
23chdir(__DIR__);
24include(__DIR__."/../file/file.inc");
25
26$path = __DIR__ . '/私はガラスを食べられますreaddir_basic';
27mkdir($path);
28create_files($path, 3);
29
30echo "\n-- Call readdir() with \$path argument --\n";
31var_dump($dh = opendir($path));
32$a = array();
33while( FALSE !== ($file = readdir($dh)) ) {
34	$a[] = $file;
35}
36sort($a);
37foreach($a as $file) {
38	var_dump($file);
39}
40
41echo "\n-- Call readdir() without \$path argument --\n";
42var_dump($dh = opendir($path));
43$a = array();
44while( FALSE !== ( $file = readdir() ) ) {
45	$a[] = $file;
46}
47sort($a);
48foreach($a as $file) {
49	var_dump($file);
50}
51
52delete_files($path, 3);
53closedir($dh);
54?>
55===DONE===
56--CLEAN--
57<?php
58$path = __DIR__ . '/私はガラスを食べられますreaddir_basic';
59rmdir($path);
60?>
61--EXPECTF--
62*** Testing readdir() : basic functionality ***
63
64-- Call readdir() with $path argument --
65resource(%d) of type (stream)
66string(1) "."
67string(2) ".."
68string(9) "file1.tmp"
69string(9) "file2.tmp"
70string(9) "file3.tmp"
71
72-- Call readdir() without $path argument --
73resource(%d) of type (stream)
74string(1) "."
75string(2) ".."
76string(9) "file1.tmp"
77string(9) "file2.tmp"
78string(9) "file3.tmp"
79===DONE===
80