A piece of code written locally (PhP 5.5.2 environment) has the following operations:
... Echo multilang ('menu ') [0];
Mutilang is used to determine the returned results in multiple languages. The returned value is a one-dimensional array.
No problems were found locally, but the program upload server encountered an error.
Syntax error, unexpected '[', expecting ';'
It means there is an unexpected '[' instead ';'
In this way:
$ TMP = multilang ('menu '); echo $ TMP [0];
But the output is normal.
No errors were found in all aspects of the check.
Later, I went online to Google and found that the version was not supported.
The current server version is 5.2.17. So I switched to php5.4.18on the server and found that no error was reported and the operation was normal.
It turns out that this expression is only supported in Versions later than PhP 5.3. The specific reasons have not been discussed. This is a question worth figuring out.
This article is also posted on my independent blog. mc-zone.me, click
Access this article