Home >Backend Development >PHP Tutorial >When referencing the config configuration file in PHP, an error will be reported. Is that a PHP version issue?

When referencing the config configuration file in PHP, an error will be reported. Is that a PHP version issue?

WBOY
WBOYOriginal
2016-12-05 13:44:111754browse

<code>parse error :syntax error,unexpected '[' ············</code>

Later I used array

If you want to use

<code>$config=[

]</code>

In this case, are there any requirements for the version?

Reply content:

<code>parse error :syntax error,unexpected '[' ············</code>

Later I used array

If you want to use

<code>$config=[

]</code>

In this case, are there any requirements for the version?

Look at the documentation. Since 5.4, you can use the short array definition syntax and use [] to replace the array() address

Paste the complete config file...

<code><?php
    return $config = [
        //.....
    ];</code>

If it looks like the above...there is no problem...

Check it out:
What’s new in PHP 5.3, 5.4, 5.5, 5.6

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn