1--TEST--
2basename() function
3--FILE--
4<?php
5    // simple checks
6    var_dump(basename("bar"));
7    var_dump(basename("/foo/bar"));
8    var_dump(basename("/bar"));
9
10    // simple checks with trailing slashes
11    var_dump(basename("bar/"));
12    var_dump(basename("/foo/bar/"));
13    var_dump(basename("/bar/"));
14
15    // suffix removal checks
16    var_dump(basename("bar.gz", ".gz"));
17    var_dump(basename("/foo/bar.gz", ".gz"));
18    var_dump(basename("/bar.gz", ".gz"));
19
20    // suffix removal checks with trailing slashes
21    var_dump(basename("bar.gz/", ".gz"));
22    var_dump(basename("/foo/bar.gz/", ".gz"));
23    var_dump(basename("/bar.gz/", ".gz"));
24
25    // suffix removal checks
26    var_dump(basename("/.gz", ".gz"));
27    var_dump(basename("/foo/.gz", ".gz"));
28    var_dump(basename("/.gz", ".gz"));
29
30    // binary safe?
31    var_dump(basename("foo".chr(0)."bar"));
32    var_dump(basename("foo".chr(0)."bar.gz", ".gz"));
33?>
34--EXPECTF--
35string(3) "bar"
36string(3) "bar"
37string(3) "bar"
38string(3) "bar"
39string(3) "bar"
40string(3) "bar"
41string(3) "bar"
42string(3) "bar"
43string(3) "bar"
44string(3) "bar"
45string(3) "bar"
46string(3) "bar"
47string(3) ".gz"
48string(3) ".gz"
49string(3) ".gz"
50string(7) "foo%0bar"
51string(7) "foo%0bar"
52