I have this line in PHP:
$bom != b"\xEF\xBB\xBF"
When I run it, I get the error:
Parse error: syntax error, unexpected T_NS_SEPARATOR in
C:\xampp\htdocs\MediaAlbumWeb\Utils\Utils.php on line 218
What is the T_NS_SEPARATOR in php and why is it unexpected?
You do a lot of Python, by any chance? b"string" is not a valid way to write your string in PHP, though it is in Python. If you just want the bytes, then you can write the string out as:
That works. If you want to check for inequality:
What are you checking for anyway? For a Byte Order Mark? And if so: why, exactly?
You likely have an unclosed single or double quote above that line in your code.
What is the
b
that's outside of the quotes?If it's a comparison, it could be something like:
Simple code to reproduce this error in PHP:
Run this, it prints an error: