Bug #62268 [Opn->Nab]: Multi dimentional Array assigment issue
| From: | rasmus@php.net | Date: | Fri, 08 Jun 2012 20:21:10 +0000 |
| Subject: | Bug #62268 [Opn->Nab]: Multi dimentional Array assigment issue | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171152@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62268&edit=1
ID: 62268
Updated by: rasmus@php.net
Reported by: dmarkweb at gmail dot com
Summary: Multi dimentional Array assigment issue
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: CentOS 6.2
PHP Version: 5.3.13
Block user comment: N
Private report: N
New Comment:
The warning you ignored should take away that surprise:
Warning: Cannot use a scalar value as an array in php shell code on line 1
since $myArray['one'] is a scalar after your first assignment. You then try to
use that scalar as an array.
Previous Comments:
------------------------------------------------------------------------
[2012-06-08 20:13:57] dmarkweb at gmail dot com
Description:
------------
I found it pretty odd and surprisingly.
When I assign a property to multi-dimentional array it doesn't setting the value
correct.
Test script:
---------------
<?php
$myArray = array();
$myArray['one'] = 1;
$myArray['one']['two'] = 1;
$myArray['one']['two']['three'] = 1;
?>
Expected result:
----------------
Array
(
[one] => Array
(
[two] => Array
(
[three] => 1
)
)
)
Actual result:
--------------
Array
(
[one] => 1
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62268&edit=1