Guu
Guu

Reputation: 961

PHP adding value to array

In PHP why is this a syntax error:

$row['some_key'] = "kkkk";

Raises

Parse error: syntax error, unexpected T_STRING

From the documentation I understood this to be perfectly valid PHP, yet it throws the same error every time (and the error of course goes away then I comment the line out).

Edit: After long searching I actually noticed that the file is indeed corrupted in some way. In Vim (on ubuntu 12.04) the file looks just normal. But when viewing from other computers it's corrupted. So not related to PHP.

Upvotes: 0

Views: 447

Answers (1)

Berry Langerak
Berry Langerak

Reputation: 18859

In PHP why is this a syntax error:

It's not. If you're getting unexpected T_STRING, the problem is elsewhere (hint: look at the line above).

Upvotes: 1

Related Questions