What is the recommended method in PHP to determine the file extension of a file?
To determine the file extension of a file in PHP, you can use the pathinfo() function. This function returns an associative array that contains information about a file path, including the file extension. By accessing the 'extension' key in the array, you can easily retrieve the file extension.
$file_path = 'path/to/your/file.txt';
$extension = pathinfo($file_path, PATHINFO_EXTENSION);
echo $extension;