4
I always use the parentheses to define an array in PHP, such as:
$array = array('a','b','c');
But once in a while I see some codes here using brackets, like:
$array = ['a', 'b', 'c'];
However, if I use square brackets, I get the error:
Parse error: syntax error, Unexpected '[' in...
What is the correct way? Has anything to do with the PHP version? Which version accepts one thing and another?
When giving a echo phpversion();
on a PHP page of my hosting get the following version:
5.2.17
I believe it is the version, in mine (7.1.15) is working normally
– Costamilam
I had just seen this, although I like the use with brackets, I’m using the brackets, never know if the hosting will support.
– Florida
I didn’t know that http://www.linuxformat.com/dvdsupport
– user60252