function FileSystemInterface::dirname

Same name in other branches
  1. 9 core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::dirname()
  2. 8.9.x core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::dirname()
  3. 11.x core/lib/Drupal/Core/File/FileSystemInterface.php \Drupal\Core\File\FileSystemInterface::dirname()

Gets the name of the directory from a given path.

PHP's dirname() does not properly pass streams, so this function fills that gap. It is backwards compatible with normal paths and will use PHP's dirname() as a fallback.

Compatibility: normal paths and stream wrappers.

Parameters

string $uri: A URI or path.

Return value

string A string containing the directory name.

See also

dirname()

https://www.drupal.org/node/515192

Related topics

File

core/lib/Drupal/Core/File/FileSystemInterface.php, line 176

Class

FileSystemInterface
Provides an interface for helpers that operate on files and stream wrappers.

Namespace

Drupal\Core\File

Code

public function dirname($uri);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.