How can the basename function in PHP be used to extract the file name without the extension?
To extract the file name without the extension in PHP, you can use the `basename` function along with `pathinfo`. First, use `pathinfo` to get the file extension, and then use `basename` to extract the file name without the extension by passing the `$filename` and `$extension` as arguments.
$filename = 'example.txt';
$extension = pathinfo($filename, PATHINFO_EXTENSION);
$basename = basename($filename, '.' . $extension);
echo $basename; // outputs 'example'