Declaring arrays with square brackets in PHP

Version 5.4 of PHP brings many useful new features, including the declaration of arrays in square brackets. Many developers will love this innovation, especially those who are used to short syntax.
Old syntax for declaring arrays:
$ array = array ();
New syntax for declaring arrays:
$ array = [];
It's up to you to use the short syntax or not when developing your projects, but the new syntax is more convenient.
Comments (0)
For commenting sign in or register.
Latest articles
- 09.07.22IT / Misc Convert office files DOC, DOCX, DOCM, RTF to DOCX, DOCM, DOC, RTF, PDF, HTML, XML, TXT formats without loss and markup changes
- 07.07.22IT / Safety How to protect PHP, JS, HTML, CSS source code - obfuscation, minification, compression and encryption
- 06.07.22IT / Safety Connection not secure, problem with Lets Encrypt - how to fix expired 09/30/2021 DST Root CA X3, remove it manually and install ISRG Root X1. Example on MS Windows 7
- 08.07.21IT / Misc How to make a free translation for a website without an API, translate documents in Google Translate
- 06.07.21IT / Misc How to make a subscription button on a website, a subscriber base and automatic mailing