Re: Manual contradiction concerning string access?
| From: | Robert Cummings | Date: | Tue, 20 Feb 2007 17:38:02 +0000 |
| Subject: | Re: Manual contradiction concerning string access? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249105@lists.php.net to get a copy of this message | ||
On Tue, 2007-02-20 at 17:21 +0100, Németh Zoltán wrote:
> AFAIK the english manual is more up to date, so I would follow that
>
> greets
> Zoltán Németh
>
> 2007. 02. 20, kedd keltezéssel 17.15-kor Christian Heinrich ezt írta:
> > Dear list,
> >
> > today, I read in a german PHP forum about a problem with accessing an
> > offset of a string.
> >
> > For example, if you have a variable like
> >
> > $string = "this is my string";
> >
> > and you want to access the third character at once, I would suggest to use
> >
> > $string{2}
Use [], internals recently (7 months or so ago) reversed their opinion
of on deprecating [] for strings in favour of {}. The {} almost got
deprecated itself, but was saved in lieu of user feedback on internals.
So it would seem [] is the superior choice and {} may someday get cut.
This is in spite of the PHP group original recommending {}.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'