This error comes in two variatians:
Variation 1
$arr = [1, 2, 3];
This array initializer syntax was only introduced in PHP 5.4; it will raise a parser error on versions before that. If possible, upgrade your installation or use the old syntax:
$arr = array(1, 2, 3);
See also this example from the manual.
Variation 2
$suffix = explode(',', 'foo,bar')[1];
Array dereferencing function results was also introduced in PHP 5.4. If it's not possible to upgrade you need to use a temporary variable:
$parts = explode(',', 'foo,bar');
$suffix = $parts[1];
See also this example from the manual.
No comments:
Post a Comment