Why does this work:
$n = explode("@", "some@email.com");
echo $n[0];
And this not work?
explode("@", "some@email.com")[0]
When I try the latter, I get:
Parse error: syntax error, unexpected '['
It works in later versions of PHP (>= 5.4.0):
PHP 5.4.0 offers a wide range of new features:
[...] - Function array dereferencing has been added, e.g. foo()[0]. [...]
Older versions of PHP do not support function array dereferencing, which is why you get a syntax error (PHP does not know what to do with the [
, so it tells you it is "unexpected").