Home php Parse error: syntax error, unexpected

Parse error: syntax error, unexpected

Author

Date

Category

Please help me figure out this error:

Parse error: syntax error, unexpected ‘[‘ in
/var/www/user/data/www/sayt.ru/index.php on line 33

Here is line 33:

if (array_key_exists ("p", $ _GET) & amp; & amp; in_array ($ _ GET ["p"] , ["admin", "password-reset"])) {

PHP version 5.3.28


Answer 1, authority 100%

There is no short syntax for arrays in PHP 5.3.x. This means that the construction

["admin", "password-reset"]

not valid.

Use

instead

array ("admin", "password-reset")

For reference:

An abbreviated syntax for defining arrays appeared only in PHP 5.4.0

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions