-5

Shouldn't this work?

$tmp = explode('=', 'name=value');
$value1 = $tmp[1]; // ok
$value2 = explode('=', 'name=value')[1]; // Parse error: syntax error, unexpected '['

(Adding unnecessary text so that the post meet the quality standard)

1 Answers1

2

You're using <=PHP5.3 on your server and the code there is valid for PHP5.4+

Change to:

$value2 = explode('=', 'name=value');
$value2 = $value2[1];

and it will work.

treyBake
  • 6,440
  • 6
  • 26
  • 57