1--TEST--
2basename() basic functionality
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip non-windows only test');
7}
8?>
9--FILE--
10<?php
11
12$file_paths = array (
13  /* simple paths (forward slashes) */
14  "bar",
15  "/foo/bar",
16  "foo/bar",
17  "/bar",
18
19  /* simple paths with trailing slashes (forward slashes) */
20  "bar/",
21  "/bar/",
22  "/foo/bar/",
23  "foo/bar/",
24  "/bar/",
25
26  /* simple paths (backslashes) */
27  "bar",
28  "\\foo\\bar",
29  "foo\\bar",
30  "\\bar",
31
32  /* simple paths with trailing slashes (backslashes) */
33  "bar\\",
34  "\\bar\\",
35  "\\foo\\bar\\",
36  "foo\\bar\\",
37  "\\bar\\",
38
39  /* paths with numeric strings */
40  "10.5\\10.5",
41  "10.5/10.5",
42  "10.5",
43  "105",
44  "/10.5",
45  "\\10.5",
46  "10.5/",
47  "10.5\\",
48  "10/10.zip",
49  "0",
50  '0',
51
52  /* path with spaces */
53  " ",
54  ' ',
55
56  /* empty paths */
57  "",
58  '',
59  NULL,
60);
61
62foreach ($file_paths as $file_path) {
63	var_dump(basename($file_path));
64}
65
66?>
67--EXPECT--
68string(3) "bar"
69string(3) "bar"
70string(3) "bar"
71string(3) "bar"
72string(3) "bar"
73string(3) "bar"
74string(3) "bar"
75string(3) "bar"
76string(3) "bar"
77string(3) "bar"
78string(8) "\foo\bar"
79string(7) "foo\bar"
80string(4) "\bar"
81string(4) "bar\"
82string(5) "\bar\"
83string(9) "\foo\bar\"
84string(8) "foo\bar\"
85string(5) "\bar\"
86string(9) "10.5\10.5"
87string(4) "10.5"
88string(4) "10.5"
89string(3) "105"
90string(4) "10.5"
91string(5) "\10.5"
92string(4) "10.5"
93string(5) "10.5\"
94string(6) "10.zip"
95string(1) "0"
96string(1) "0"
97string(1) " "
98string(1) " "
99string(0) ""
100string(0) ""
101string(0) ""
102