Get the App
SLTechnology News&Howtos  ›  Development  › 

How PHP uses the basename () function

Shulou Source: shulou.com Published: 2022-06-01 02:34:08 11月28日 Update

This article will explain in detail how PHP uses the basename () function. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Basename ();-- returns the file name portion of the path.

String basename (string $path [, string $suffix]) / / gives a string containing the full path to a file, and this function returns the basic file name.

Parameter: path a path. In Windows, both the slash (/) and the backslash (\) can be used as directory separators. In other environments, it is a slash (/)

Suffix if the file name ends with suffix, this part will also be removed.

Return value: returns the basic file name of the path.

$path ='d _

Echo basename ($path,'.txt'); this is the end of the article on "how PHP uses the basename () function". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: File file name function slash article path more good practical content delimiter parameter character string point article environment directory knowledge part Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Redmi Linux macOS Microsoft