What is the function basename() in PHP used for?
The function `basename()` in PHP is used to extract the filename from a given path. This can be useful when you have a full file path and only need the actual name of the file. The `basename()` function returns the base name of the file without the directory information.
// Example of using basename() function
$file_path = '/path/to/file.txt';
$file_name = basename($file_path);
echo $file_name; // Output: file.txt