Example #3 of Php manual's declare(encoding)
(source) has this snippet of code:
<?php
declare(encoding='ISO-8859-1');
// code here
?>
However, when I tried to run the exact code above, it doesn't work:
Fatal error: Encoding declaration pragma must be the very first statement in the script in C:\xampp\htdocs\test\index.php on line 2
The error message asserts that declare
is not the first statement, but the code shows that there's nothing before it.
What may be causing the error?
How do we fix it?