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
Release: 2023-03-03 08:42:01
Original
1757 people have browsed it

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

Later I used array

If you want to use

<code>$config=[

]</code>
Copy after login
Copy after login

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

Reply content:

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

Later I used array

If you want to use

<code>$config=[

]</code>
Copy after login
Copy after login

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>
Copy after login

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

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template