PHP use function return value as array

Posted by Richard Knop on Stack Overflow See other posts from Stack Overflow or by Richard Knop
Published on 2010-05-17T17:57:33Z Indexed on 2010/05/17 18:00 UTC
Read the original article Hit count: 206

Filed under:

Why is it that this works:

        $cacheMatchesNotPlayed = $cache->load('externalData');
        $cacheMatchesNotPlayed = $cacheMatchesNotPlayed['matchesNotPlayed'];

But this doesn't work:

        $cacheMatchesNotPlayed = $cache->load('externalData')['matchesNotPlayed'];

Is there some reason for it? The second bit is easier to write.

© Stack Overflow or respective owner

Related posts about php