note 103390 added to function.compact

From: Date: Tue, 12 Apr 2011 00:40:24 +0000
Subject: note 103390 added to function.compact
Groups: php.notes 
Request: Send a blank email to php-notes+get-178712@lists.php.net to get a copy of this message
@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. ---- Server IP: 69.147.83.197 Probable Submitter: 71.220.218.9 ---- Manual Page -- http://www.php.net/manual/en/function.compact.php Edit -- https://master.php.net/note/edit/103390 Del: integrated -- https://master.php.net/note/delete/103390/integrated Del: useless -- https://master.php.net/note/delete/103390/useless Del: bad code -- https://master.php.net/note/delete/103390/bad+code Del: spam -- https://master.php.net/note/delete/103390/spam Del: non-english -- https://master.php.net/note/delete/103390/non-english Del: in docs -- https://master.php.net/note/delete/103390/in+docs Del: other reasons-- https://master.php.net/note/delete/103390 Reject -- https://master.php.net/note/reject/103390 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178712) next »