Bug #12274 Updated: parser/string access problems
| From: | zak@php.net | Date: | Fri, 20 Jul 2001 18:22:41 +0000 |
| Subject: | Bug #12274 Updated: parser/string access problems | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-60430@lists.php.net to get a copy of this message | ||
ID: 12274
Updated by: zak
Reported By: tegel@dubaron.com
Old Status: Closed
Status: Bogus
Bug Type: Strings related
Operating System: NT4
PHP Version: 4.0.4pl1
New Comment:
Oops - that should be bogus, not closed. :)
Previous Comments:
------------------------------------------------------------------------
[2001-07-20 14:20:38] zak@php.net
The use of brackets as to access a single character from a string is deprecated.
Use curly braces instead and you will experience the expected behavior.
i.e.
<?php
$foo = 'bar';
$foo{2} = 't';
echo $foo;
?>
There is additional information at http://www.php.net/manual/en/language.types.string.php
------------------------------------------------------------------------
[2001-07-20 05:55:38] tegel@dubaron.com
Suppose a string $t:
one can access(read) all single characters of $t by reading elements $t[0] .. $t[n]
Setting $t[0] however fails, setting $t[1] .. $t[n] succeeds.
Looks like when setting element [0] that $t gets converted to array type, and after setting $t[0]
the values $t[1]..$t[n] are simply lost.
why not this behaviour with other indexes as well, only with item[0] ? - that's not consistent.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=12274&edit=1