Re: Illegal use of string offset
| From: | Marcus Boerger | Date: | Tue, 27 Apr 2004 12:16:43 +0000 |
| Subject: | Re: Illegal use of string offset | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9585@lists.php.net to get a copy of this message | ||
Hello Christian,
Tuesday, April 27, 2004, 1:34:47 PM, you wrote:
> Marcus Boerger wrote:
>>>[ $a = 'foo'; $a['bar'] = 42; has an even weirder behaviour: It
>>>results
>>>in the string '4oo'... ]
>>
>> That's a pretty. It is using 'bar' as a sting index to 'foo' and
>> to do
>> this it needs to convert 'bar' to an integer. The rest is obvious.
> So you find it obvious that 42 is cast to string and the first character
> is used as replacement? Wasn't obvious to me before I tried it :-)
That's what i meant it confuses far too many people and doesn't even make
real sense. For example converting 42 into chr(42) and setting it would
follow the same autoconversion logic. Hence a hint of kind E_STRICT would
be very good.
marcus