Re: $scalar{index} syntax
| From: | Rasmus Lerdorf | Date: | Wed, 11 Dec 2002 06:37:52 +0000 |
| Subject: | Re: $scalar{index} syntax | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-92331@lists.php.net to get a copy of this message | ||
You mean $string{2} ? That's the more correct way to do $string[2] to
make it clear that it is a character offset. This has been supported for
years and will not go away.
-Rasmus
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?
>
> thanks
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>