9 ms·
PHP has array dereferencing, closures, and array short syntax since 5.4. $func = function() { return ['a', 'b', 'c']; }; echo $func()[0];
by steelaz 14y ago
PHP has array dereferencing, closures, and array short syntax since 5.4.
$func = function() { return ['a', 'b', 'c']; };
echo $func()[0];
- eru 14y agoNice to hear that they fixed those. I just read about the new closures. Too bad, scoping is still somewhat broken: You have to explicitly declare the variables you want to use from the outer scope.