I am having issues using multiple or
conditions.
Here the code, very simple :
<?php
$a = "a";
if($a == "a" || $a == "b" || $a == "c" || $a == "d" || $a == "e")
{echo "test";}
?>
But PHP displays this error :
Parse error: syntax error, unexpected '$a' (T_VARIABLE) in /home/guest/public_html/or.php on line 5
So I was right in the comments: it's a (yet another) Case of Invisible Characters. Here's what's really stored in your file:
if($a == "a" ||\u00A0$a == "b" ||\u00A0$a == "c" || $a == "d" || $a == "e")
As you see, in two places $a
is preceded not with a normal whitespace, but with something else - a special character, so called Non-breaking space one. It's not visually different from a normal whitespace, and it's truncated by StackOverflow engine when you paste the code into the question. But it messes up how the parser interprets your code - hence an error.