-6

I have an Index php page that contains a code that prints the values of an array $a=['f','a','b'];.

The code works fine on WAMP server on my computer however when I upload the page online on a server like 000webhost an error comes up that says there is unexpected '[' on line of the array. Does anyone know why this happens?

halfer
  • 19,471
  • 17
  • 87
  • 173

1 Answers1

2

Your PHP version doesn't support the [] notation, this kind of notation is available from PHP 5.4, use $a = array('f','a','b'); instead.

halfer
  • 19,471
  • 17
  • 87
  • 173
Ende Neu
  • 15,261
  • 5
  • 53
  • 68