Shorthand array doesn't work on server

2020-04-12 01:46发布

问题:

I'm hosting a standard website from http://www.versio.nl/ and I'm always getting the error Parse: syntax error, unexpected '['. I would have to change all the [] array notifications with array(). But is there a possiblity that I can change a setting or so? Or could it be they still work with an old version of PHP? (Looks strange to me)

回答1:

only php 5.4.x and up works with the new shorthand array syntax, if your server version is lower then 5.4 then there's no way to make it work, you'll need to change the syntax to the old syntax.

you could try to see the version using

echo phpinfo();