syntax error, unexpected token “,”, expecting “]”¶
Description¶
A comma was found in an array syntax: the syntax is $variable[$index]
, and there can be only one index between the brackets.
Example¶
<?php
echo $a[1,2];
?>
Solutions¶
Remove the comma and the code after it, until the closing bracket.
Close the square bracket, open a new one and remove the comma:
$a[1][2]
.