tags:

views:

92

answers:

2

Parse error: syntax error, unexpected T_VARIABLE

This is the line that got the error:

$list[$i][$docinfo['attrs']['@groupby']] = $docinfo['attrs']['@count'];

Is there anything wrong?

A: 

it could be some other line as well, PHP is not always that exact.

I am not sure @ character is allowed in array keys? but probably you are just missing a semicolon on previous line.

dusoft
no,not this time:)
Shore
+1  A: 

there might be a semicolon or bracket missing a line before. your pasted line seems fine to me, every string is allowed as array index

knittl
Oh you reminded me,it's a bracket missed.Why it's called T_VARIABLE?
Shore
The error message tells you what's there (unexpected), not what's missing. And there's a variable, so it tells you exactly that.
OregonGhost
Because the unexpected `$list` is a variable.
Michael Krelin - hacker
because php was expecting a bracket and found a variable, that's why it tells you ‘unexpected variable’
knittl