Gen. partnerAlgotech

PHP function dirname()

Returns directory name component of path

|
September 11, 2019

Availability in PHP 4.0

Returns directory name component of path

Parameters

Parameter Data type Default value Note
$path string not A path.
$levels int 1 The number of parent directories to go up. This must be an integer greater than 0.

Return values

string

the name of the directory. If there are no slashes in path, a dot ('.') is returned, indicating the current directory. Otherwise, the returned string is path with any trailing /component removed.

Additional resources

Official dirname documentation

Loading comments...

Stay in the loop

Subscribe to our newsletter and get the latest cybersecurity news delivered straight to your inbox.

Your data is safe. You can unsubscribe from the newsletter at any time.