note 103390 deleted from function.compact by danbrown
| From: | danbrown@php.net | Date: | Tue, 12 Apr 2011 13:38:29 +0000 |
| Subject: | note 103390 deleted from function.compact by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178771@lists.php.net to get a copy of this message | ||
Note Submitter: outis
----
@ryan: that's not a problem with compact(), that's a PHP issue with indexing arrays
returned from functions (AKA function call-array chaining; see http://bugs.php.net/bug.php?id=50003). The following
code produces the same error:
<?php
function foo() {
return array('tom' => 'Thomas the Cat', 'jerry' =>
'Jerry the Mouse');
}
print_r(foo()['tom']);
?>
This might be fixed in PHP 6.