method basename documentation in bbn\X
Returns the basename, working with multibytes strings.
function(string $path, string $suffix = '')
{
$res = '';
// works both in windows and unix
if (preg_match('@^.*[\\\\/]([^\\\\/]+)$@s', $path, $matches)) {
$res = $matches[1];
}
else if (preg_match('@^([^\\\\/]+)$@s', $path, $matches)) {
$res = $matches[1];
}
if ($res && $suffix && (substr($res, - strlen($suffix)) === $suffix)) {
return substr($res, 0, - strlen($suffix));
}
return $res;
}
Returns the basename, working with multibytes strings. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions