|
Posted by Jerry Stuckle on 12/02/06 14:24
Ira Gladnick wrote:
> Norman Peelman wrote:
>
>>You use { } on strings such as:
>>
>>$someString1 = "0123456789";
>>$someString2 = "rock 'n roll";
>>
>>echo $someString1{5} will output:
>>5
>
>
> Interesting.
>
> But I was actually doing an assignment using the brace notation:
> SomeArray{0} = $somevalue
>
> And, when I did a print_r($SomeArray), it displayed as being an array
> with the zero element being the assigned value (if I change the
> assignment to SomeArray{99} = $somevalue, then it shows the 99th array
> element as holding $somevalue).
>
> So in this situation it seems that braces are equivalent to array
> brackets, and are doing something different than string indexing. But
> as mentioned, I can't seem to find any documentation indicating this
> usage.
>
> This kind of brace usage came up in the context of a certification
> practice exam.
>
I don't think this was ever legal for arrays - just something which
wasn't properly caught. At least I've never seen this syntax for arrays
in any of the official PHP doc.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|