yii\helpers\BaseStringHelper::dirname PHP Method

dirname() public static method

This method is similar to dirname() except that it will treat both \ and / as directory separators, independent of the operating system.
See also: http://www.php.net/manual/en/function.basename.php
public static dirname ( string $path ) : string
$path string A path string.
return string the parent directory's path.
    public static function dirname($path)
    {
        $pos = mb_strrpos(str_replace('\\', '/', $path), '/');
        if ($pos !== false) {
            return mb_substr($path, 0, $pos);
        } else {
            return '';
        }
    }