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