function - invoking php methods directly -
this question has answer here:
- php: access array value on fly 8 answers
why work:
$n = explode("@", "some@email.com"); echo $n[0];
and not work?
explode("@", "some@email.com")[0]
when try latter, get:
parse error: syntax error, unexpected '['
it works in later versions of php (>= 5.4.0):
php 5.4.0 offers wide range of new features:
[...] - function array dereferencing has been added, e.g. foo()[0]. [...]
older versions of php not support function array dereferencing, why syntax error (php not know [
, tells "unexpected").
Comments
Post a Comment