What role does the BOM (Byte Order Mark) play in the encoding of the configuration file in this PHP script?

The BOM (Byte Order Mark) is a special character used to indicate the encoding of a text file. In this PHP script, the BOM may be causing issues with the encoding of the configuration file. To solve this issue, you can remove the BOM from the configuration file to ensure proper encoding.

$config = file_get_contents('config.txt');
$config = preg_replace('/^\x{FEFF}/u', '', $config);