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);
60
61foreach ($file_paths as $file_path) {
62    var_dump(basename($file_path));
63}
64
65?>
66--EXPECT--
67string(3) "bar"
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(8) "\foo\bar"
78string(7) "foo\bar"
79string(4) "\bar"
80string(4) "bar\"
81string(5) "\bar\"
82string(9) "\foo\bar\"
83string(8) "foo\bar\"
84string(5) "\bar\"
85string(9) "10.5\10.5"
86string(4) "10.5"
87string(4) "10.5"
88string(3) "105"
89string(4) "10.5"
90string(5) "\10.5"
91string(4) "10.5"
92string(5) "10.5\"
93string(6) "10.zip"
94string(1) "0"
95string(1) "0"
96string(1) " "
97string(1) " "
98string(0) ""
99string(0) ""
100