Bug #18103 Updated: Incorrect behavior of multi-dimensional Array
| From: | alan_k@php.net | Date: | Tue, 02 Jul 2002 03:37:42 +0000 |
| Subject: | Bug #18103 Updated: Incorrect behavior of multi-dimensional Array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-12756@lists.php.net to get a copy of this message | ||
ID: 18103
Updated by: alan_k@php.net
Reported By: stephung@mosp.net
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: ALL
PHP Version: 4.2.1
New Comment:
two at the same time :)
Previous Comments:
------------------------------------------------------------------------
[2002-07-01 23:36:04] alan_k@php.net
it is the correct behaviour
since test['foo'] is a string, using an array '[]' on a string returns
the character:
eg.
echo $test['foo'][1]; //will equal 'b'
since ['bar'] evalates to 0 (zero)
it will replace character 'a' with the first character of "123"..
it would be nice to emit warnings on string[] format as string{n} is
the advised method of using string position retreival/setting..
------------------------------------------------------------------------
[2002-07-01 23:35:42] sniper@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
------------------------------------------------------------------------
[2002-07-01 23:26:10] stephung@mosp.net
The following code:
$test['foo'] = "abc";
$test['foo']['bar'] = "123";
echo $test['foo']; // Output "1bc"
The output is "1bc". IMO, "abc" would be the only semantically correct
output, although "Array" is also acceptable, which means value "abc" is
replaced by array( 'bar' => "123"). The actual output "1bc" is
definietly not correct. This happens on all versions of PHP.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18103&edit=1