What are some best practices for handling file suffixes in PHP and extracting file information?

When handling file suffixes in PHP, it is important to properly extract file information such as the file extension. One best practice is to use the built-in PHP functions like pathinfo() to extract file information. This function returns an associative array containing information about the file path, including the file extension.

// Example code to extract file information using pathinfo()
$file_path = '/path/to/file/example.txt';
$file_info = pathinfo($file_path);

$file_extension = $file_info['extension'];
echo 'File extension: ' . $file_extension;