#48903 [Bgs]: Lambda function as array index
| From: | ninzya at inbox dot lv | Date: | Mon, 13 Jul 2009 13:50:49 +0000 |
| Subject: | #48903 [Bgs]: Lambda function as array index | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-139690@lists.php.net to get a copy of this message | ||
ID: 48903
User updated by: ninzya at inbox dot lv
Reported By: ninzya at inbox dot lv
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 5.3.0
New Comment:
Yep, my typo, just figured out. Incorrectly used lambdas.
Previous Comments:
------------------------------------------------------------------------
[2009-07-13 13:34:24] colder@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
You can't, as usual, use objects as array keys.
Check out SplObjectStorage.
------------------------------------------------------------------------
[2009-07-13 13:29:35] ninzya at inbox dot lv
Description:
------------
See reproduce code.
Reproduce code:
---------------
<?php
$arr =array();
$arr[function(){return 5;}] ='Stepanov';
var_dump( $arr);
?>
Expected result:
----------------
array(1) {
[5]=>
string(8) "Stepanov"
}
Actual result:
--------------
Warning: Illegal offset type in D:\...\index.php on line 5
array(0) {
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48903&edit=1