Hi, I have been using PHP for a couple of years,
these are the PHP ways that I know to declare an array
$arr = array();
$arr = array(1,2);
$arr[0] = 1;
$arr[] = 1;
In the example, I saw this syntax, and I ran the code, and it was right:
$a{0} = "value";
but the following code did not execute:
$a{} = "value";
He gave:
Parse error: syntax error, unexpected '}'
How to explain this?
source
share