Re: Why the Change in Ver 4?
| From: | Toby Butzon | Date: | Sat, 27 Jan 2001 15:32:32 +0000 |
| Subject: | Re: Why the Change in Ver 4? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-36979@lists.php.net to get a copy of this message | ||
Yea, it's true. There was a post a couple of weeks ago from Rasmus
(IIRC) that explained the reasoning: the [] form is used on strings and
arrays, so PHP has to figure out which one it's dealing with before it
can return a result. If $myAr[] and $myStr{} are seperate, the
interpretter will know instantly which one it's dealing with, and the
step can be skipped.
Also, IMO, it helps the programmer - you, too, know when you're dealing
with strings and when you're dealing with arrays, just by the indexing
operator used.
--Toby
Richard Lynch wrote:
>
> If that's even true (I dunno) maybe because strings in PHP really aren't
> arrays of characters like C...
>
> And maybe they got plans for arrays that would be too easy to confuse
> syntactically with strings or something...
>
> [shrug]
>
> --
> Visit the Zend Store at http://www.zend.com/store/
> Wanna help me out? Like Music? Buy a CD:
> http://l-i-e.com/artists.htm
> Volunteer a little time: http://chatmusic.com/volunteer.htm
> ----- Original Message -----
> From: "Karl J. Stubsjoen" <karlflips@kstub.com>
> Newsgroups: php.general
> Sent: Friday, January 26, 2001 10:58 AM
> Subject: [PHP] Why the Change in Ver 4?
>
> > > > >Does Version 4 support either { } "squiglees" or [ ]
> > > > >"brackets" in
> this
> > > > >code:
> > > > >
> > > > >if($retrn{strlen($retrn)-1} == '&')
> > > > >-or-
> > > > >if($retrn[strlen($retrn)-1] == '&')
> > > >
> > > > Yes. This is a 4.x feature only. The idea is that in the long run,
> []
> > > > will no longer be supported for string offsets, only {} will.
> >
> > What is the motivation behind this change?
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net