File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
strings /
basename.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
basename() function
--FILE--
<?php
// simple checks
var_dump(basename("bar"));
var_dump(basename("/foo/bar"));
var_dump(basename("/bar"));
// simple checks with trailing slashes
var_dump(basename("bar/"));
var_dump(basename("/foo/bar/"));
var_dump(basename("/bar/"));
// suffix removal checks
var_dump(basename("bar.gz", ".gz"));
var_dump(basename("/foo/bar.gz", ".gz"));
var_dump(basename("/bar.gz", ".gz"));
// suffix removal checks with trailing slashes
var_dump(basename("bar.gz/", ".gz"));
var_dump(basename("/foo/bar.gz/", ".gz"));
var_dump(basename("/bar.gz/", ".gz"));
// suffix removal checks
var_dump(basename("/.gz", ".gz"));
var_dump(basename("/foo/.gz", ".gz"));
var_dump(basename("/.gz", ".gz"));
// binary safe?
var_dump(basename("foo".chr(0)."bar"));
var_dump(basename("foo".chr(0)."bar.gz", ".gz"));
?>
--EXPECT--
string(3) "bar"
string(3) "bar"
string(3) "bar"
string(3) "bar"
string(3) "bar"
string(3) "bar"
string(3) "bar"
string(3) "bar"
string(3) "bar"
string(3) "bar"
string(3) "bar"
string(3) "bar"
string(3) ".gz"
string(3) ".gz"
string(3) ".gz"
string(7) "foo bar"
string(7) "foo bar"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>