2 added 88 characters in body
source | link

Directly dereference arrays returned from functions.

E.g., instead of this:

$a = foo();
echo $a[$n];

You can do:

echo foo()[$n];

This works with methods too:

echo $obj->foo()[$n];

You can also directly dereference array declarations:

echo [1, 2, 3, 4, 5][$n];

Directly dereference arrays returned from functions.

E.g., instead of this:

$a = foo();
echo $a[$n];

You can do:

echo foo()[$n];

This works with methods too:

echo $obj->foo()[$n];

Directly dereference arrays returned from functions.

E.g., instead of this:

$a = foo();
echo $a[$n];

You can do:

echo foo()[$n];

This works with methods too:

echo $obj->foo()[$n];

You can also directly dereference array declarations:

echo [1, 2, 3, 4, 5][$n];
1
source | link

Directly dereference arrays returned from functions.

E.g., instead of this:

$a = foo();
echo $a[$n];

You can do:

echo foo()[$n];

This works with methods too:

echo $obj->foo()[$n];