1--TEST--
2Test glob() function: basic functions
3--FILE--
4<?php
5echo "*** Testing glob() : basic functions ***\n";
6
7$file_path = __DIR__;
8
9// temp dirname used here
10$dirname = "$file_path/glob_basic";
11
12// temp dir created
13mkdir($dirname);
14
15// temp files created
16$fp = fopen("$dirname/wonder12345", "w");
17fclose($fp);
18$fp = fopen("$dirname/wonder.txt", "w");
19fclose($fp);
20$fp = fopen("$dirname/file.text", "w");
21fclose($fp);
22
23// glob() with default arguments
24sort_var_dump( glob($dirname."/*") );
25sort_var_dump( glob($dirname."/*.txt") );
26sort_var_dump( glob($dirname."/*.t?t") );
27sort_var_dump( glob($dirname."/*.t*t") );
28sort_var_dump( glob($dirname."/*.?") );
29sort_var_dump( glob($dirname."/*.*") );
30
31echo "Done\n";
32
33function sort_var_dump($results) {
34   sort($results);
35   var_dump($results);
36}
37?>
38--CLEAN--
39<?php
40$file_path = __DIR__;
41unlink("$file_path/glob_basic/wonder12345");
42unlink("$file_path/glob_basic/wonder.txt");
43unlink("$file_path/glob_basic/file.text");
44rmdir("$file_path/glob_basic/");
45?>
46--EXPECTF--
47*** Testing glob() : basic functions ***
48array(3) {
49  [0]=>
50  string(%d) "%s/glob_basic/file.text"
51  [1]=>
52  string(%d) "%s/glob_basic/wonder.txt"
53  [2]=>
54  string(%d) "%s/glob_basic/wonder12345"
55}
56array(1) {
57  [0]=>
58  string(%d) "%s/glob_basic/wonder.txt"
59}
60array(1) {
61  [0]=>
62  string(%d) "%s/glob_basic/wonder.txt"
63}
64array(2) {
65  [0]=>
66  string(%d) "%s/glob_basic/file.text"
67  [1]=>
68  string(%d) "%s/glob_basic/wonder.txt"
69}
70array(0) {
71}
72array(2) {
73  [0]=>
74  string(%d) "%s/glob_basic/file.text"
75  [1]=>
76  string(%d) "%s/glob_basic/wonder.txt"
77}
78Done
79