Unexpected bracket '[' - PHP [duplicate]

Solution 1:

That's called array dereferencing and only works in PHP 5.4+. You're probably running PHP 5.3.x wherever you are getting that error.

See results based on different PHP versions