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" [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
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]
--
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]