Re: $scalar{index} syntax
| From: | Derick Rethans | Date: | Wed, 11 Dec 2002 16:33:32 +0000 |
| Subject: | Re: $scalar{index} syntax | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-92363@lists.php.net to get a copy of this message | ||
On Tue, 10 Dec 2002, Brad Bulger wrote:
>
> trying to fix bugs in some PEAR code, i noticed the person used a way
> of getting at the individual characters in a string:
>
> $string{2} === substr($string,2,1)
>
> is that old syntax or something? is there any reason to expect it to work
> in future versions?
This is the recommended systax. (over $string[2]).
Derick
--
-------------------------------------------------------------------------
Derick Rethans http://derickrethans.nl/
PHP Magazine - PHP Magazine for Professionals http://php-mag.net/
-------------------------------------------------------------------------