Is there anything wrong with having a convention for character access of 
strings? Most PHP programmers see {} as string access and [] as array access - 
sure, they might be functionally identical, but its the convention which is 
important.

Jevon


>  -------Original Message-------
>  From: Rasmus Lerdorf <[EMAIL PROTECTED]>
>  Subject: Re: [PHP-DEV] dropping curly braces
>  Sent: 17 Nov '05 12:11
>  
>  Andreas Korthaus wrote:
>  >> As far a code readability and obviousness goes, I doubt anybody would
>  >> guess their way to the $str{5} syntax.
>  >
>  > But you know without understanding of any context, that it's the 6th
>  > character of the string "$str". When you see $var[5], it could be the
>  > 6th character of a string, or an element of an array... and what about
>  > the value? You can't be sure that it's a string with length 1, it also
>  > could be another array, an object, a string with length 4711...
>  >
>  > That increases complexity and decreases readability.
>  
>  Your argument falls apart there.  Try it:
>  
>  $a = array("ab","cd","ef");
>  echo $a{2};
>  
>  Guess what that prints?  {} has nothing to do with strings.  They are
>  100% equivalent to [] and as such add nothing to clarity.
>  
>  -Rasmus
>  
>  --
>  PHP Internals - PHP Runtime Development Mailing List
>  To unsubscribe, visit: http://www.php.net/unsub.php
>  
>  

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to