When you create a new array in PHP, it’s common to see it declared like this:

$myArray = array(1, 2, 3);

However since PHP 5.4 you can now declare an array using a much shorter syntax:

$myArray = [1, 2, 3];

This brings PHP in line with many other languages and helps make your code a little cleaner.

Leave a Reply