Yes thank you, I thought I would have heard about it before now if all 
brackets were deprecated!  ;) I bit, though, when I read that page you 
linked to.

Thanks for the clarification though.


Erik



On Thursday, January 17, 2002, at 03:49  PM, Steve Edberg wrote:

> Sorry if I was less than totally clear; I was referring to this part of 
> the page:
>
> --------------------------------
> Characters within strings may be accessed by specifying the zero-based 
> offset of the desired character after the string in curly braces.
>
> Note: For backwards compatibility, you can still use the array-braces. 
> However, this syntax is deprecated as of PHP 4.
>
> Example 6-3. Some string examples
>
> <SNIP>
>
> /* Get the first character of a string  */
> $str = 'This is a test.'
> $first = $str{0};
> --------------------------------
>
> ...and that was the first I'd noticed that myself; I assume that the {} 
> syntax is only being used to refer to arrays as strings, to avoid 
> confusion with an array of strings -
>
>       $str = array('string 1', 'thing 2');
>       echo $str[0]; # produces 'string 1'
>
> - and a scalar string variable being treated as an array of characters. 
> So I'm guessing (too lazy to test right at the moment) that you would 
> get
>
>       $str = array(array('bork','fubar'), 'snafu');
>       echo $str[0][1]; # produces 'fubar'
>       echo $str[1][1]; # produces null
>       echo $str[1]{1}; # produces 'n'
>
> Again, that's just what I'm assuming from the docs. A quick test would 
> clear it up, but it doesn't affect me right now, and I'm feeling lazy ;)
>
> Hope that clears up my statement...
>
>       -steve
>
>
> At 12:11 PM -0500 1/17/02, Erik Price wrote:
>> I didn't know that either.  Does this apply only when accessing 
>> strings by character?  Or are all conventional uses of brackets 
>> deprecated for the purposes of arrays?
>>
>> It doesn't say on that page 
>> (http://www.php.net/manual/en/language.types.string.php , a bit more 
>> than halfway down).
>>
>>
>> Erik
>>
>>>
>>>> Actually, using the [] syntax is deprecated - using {} is the new way
>>>> - but I'm a creature of habit...
>>>>
>>
>>
>
>
> -- 
> +------------------------------------------------------------------------+
> | Steve Edberg                                      
> [EMAIL PROTECTED] |
> | University of California, Davis                          
> (530)754-9127 |
> | Programming/Database/SysAdmin               
> http://pgfsun.ucdavis.edu/ |
> +------------------------------------------------------------------------+
> | "Restriction of free thought and free speech is the most dangerous 
> of  |
> | all subversions. It is the one un-American act that could most 
> easily  |
> | defeat 
> us."                                                            |
> |                 - Supreme Court Justice (1939-1975) William O. 
> Douglas |
> +------------------------------------------------------------------------+
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to