yii\helpers\BaseStringHelper::basename PHP Method

basename() public static method

This method is similar to the php function basename() except that it will treat both \ and / as directory separators, independent of the operating system. This method was mainly created to work on php namespaces. When working with real file paths, php's basename() should work fine for you. Note: this method is not aware of the actual filesystem, or path components such as "..".
See also: http://www.php.net/manual/en/function.basename.php
public static basename ( string $path, string $suffix = '' ) : string
$path string A path string.
$suffix string If the name component ends in suffix this will also be cut off.
return string the trailing name component of the given path.
    public static function basename($path, $suffix = '')
    {
        if (($len = mb_strlen($suffix)) > 0 && mb_substr($path, -$len) === $suffix) {
            $path = mb_substr($path, 0, -$len);
        }
        $path = rtrim(str_replace('\\', '/', $path), '/\\');
        if (($pos = mb_strrpos($path, '/')) !== false) {
            return mb_substr($path, $pos + 1);
        }
        return $path;
    }