Created
February 26, 2011 15:01
-
-
Save bxt/845272 to your computer and use it in GitHub Desktop.
PHP is failing to immidately acces an array returned by a function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo foo()[0]; // PHP Parse error: syntax error, unexpected '[', expecting ',' or ';' | |
function foo() { | |
return array("cant thouch this"); | |
} | |
// use this instead: | |
list($tmp)= foo(); | |
echo $tmp; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will change soon:
http://schlueters.de/blog/archives/138-Features-in-PHP-trunk-Array-dereferencing.html