nialna2
nialna2

Reputation: 2224

PHP doesn't compile when there is a space before array creation

So I just spent 30 minutes trying to debug my code, when I finally understood that:

$words = array("word", "word", "word"); // doesn't compile
$words =array("word", "word", "word"); // Does compile

I just tried deleting the space between "=" and "array" as a sort of desperate random try and it worked. Is it a normal behaviour from PHP, considering usually the "=" instruction is totally fine with spaces?

Upvotes: 0

Views: 47

Answers (1)

nialna2
nialna2

Reputation: 2224

Ok it was some sort of special character that looks exactly like a space but wasn't one. Putting back a normal space worked.

Upvotes: 1

Related Questions