I have a very simple IF statement...
if ($key == "listingURL" or
$key == "interiorColor" or
$key == "engine" or
$key == "transmission" or
$key == "stockNumber" or
$key == "VIN") {
// Do thing
}
But I'm receiving an error...
[23-Apr-2015 13:12:01 UTC] PHP Parse error: syntax error, unexpected T_VARIABLE in xxx on line xxx
Which is this line...
$key == "stockNumber" or
Is there a limit to the maximum amount of OR's, or am I missing something staring me right in the face?
"Is there a limit to the maximum amount of OR's, or am I missing something staring me right in the face?"
No there isn't. The reason is because you have a hidden character:
$key == "transmission" or ? <= right there
Which is 
Being a Unicode ZERO WIDTH NO-BREAK SPACE character.
Rewrite:
if ($key == "listingURL" or
$key == "interiorColor" or
$key == "engine" or
$key == "transmission" or
$key == "stockNumber" or
$key == "VIN") {
// Do thing
}
Sidenotes:
As from the comments:
I'll confirm this as the correct answer as soon as the time limit is up! Thank you so much for the help. I use Sublime Text 3, is there some easy way to detect these hidden characters? – SoWizardly 19 mins ago
For Notepad++
there is a plugin called: HEX-Editor
.
You can download it via: Extensions -> Plugin Manager -> Available. Just check the combo box for HEX-Editor
and click install. After this you can change your file view to hexadecimal.
For Sublime Text
there is also a plugin, which does the same.
When i copy in other editor i get this remove it near stock number ? <=
if ($key == "listingURL" or
$key == "interiorColor" or
$key == "engine" or
$key == "transmission" or
$key == "stockNumber" or ? <=
$key == "VIN") {
// Do thing
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With