PHP use return value of function as array
Why it works:
$cacheMatchesNotPlayed = $cache->load('externalData');
$cacheMatchesNotPlayed = $cacheMatchesNotPlayed['matchesNotPlayed'];
But this doesn't work:
$cacheMatchesNotPlayed = $cache->load('externalData')['matchesNotPlayed'];
Is there any reason for this? The second bit is easier to write.
a source to share
PHP does not support the function array unordering you want to do.
See the RFC on the topic http://wiki.php.net/rfc/functionarraydereferencing and related mailings that were rejected last year around this time. While there has been support for this, and it's still a common query (usually "why doesn't this work?"), There are no plans to introduce this syntax.
As for why, it is just that the code that implements it has not been submitted for approval (if it has been written at all).
Update
This feature is implemented in the trunk (main development) of PHP and will probably be included in the next version without a fix (5.4.0). For those who want to play with FAD, feel free to upload an outside line snapshot .
a source to share