Skip to content

Instantly share code, notes, and snippets.

@bxt
Created February 26, 2011 15:01
Show Gist options
  • Save bxt/845272 to your computer and use it in GitHub Desktop.
Save bxt/845272 to your computer and use it in GitHub Desktop.
PHP is failing to immidately acces an array returned by a function
<?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;
@bxt
Copy link
Author

bxt commented Feb 28, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment