Sign in Registration

Declaring arrays with square brackets in PHP

Объявление массивов квадратными скобками в 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

Popular sections


Login to the web version
Android app:
Available on Google Play

Share this

Subscribe to