I always use the parentheses to define an array in PHP, such as:
$array = array('a','b','c');
But every now and then I see some code here using brackets, like:
$array = ['a', 'b', 'c'];
However, if I use brackets, I get the error:
Parse error: syntax error, unexpected '[' in ...
What is the correct way? Does it have anything to do with the PHP version? Which version accepts one thing and another?
By giving echo phpversion();
in a PHP page of my hosting I get the following version:
5.2.17