Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20110 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59592 invoked by uid 1010); 17 Nov 2005 23:26:52 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 59577 invoked from network); 17 Nov 2005 23:26:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2005 23:26:52 -0000 X-Host-Fingerprint: 80.67.18.15 smtprelay03.ispgateway.de Linux 2.4/2.6 Received: from ([80.67.18.15:33323] helo=smtprelay03.ispgateway.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 7E/99-07637-BB11D734 for ; Thu, 17 Nov 2005 18:26:52 -0500 Received: (qmail 12687 invoked from network); 17 Nov 2005 23:26:48 -0000 Received: from unknown (HELO [192.168.178.21]) (134348@[80.137.10.70]) (envelope-sender ) by smtprelay03.ispgateway.de (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 17 Nov 2005 23:26:48 -0000 Message-ID: <437D11B7.7090102@web.de> Date: Fri, 18 Nov 2005 00:26:47 +0100 User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: Rasmus Lerdorf CC: internals@lists.php.net References: <437B530A.5050105@prohost.org> <437CF6B4.5080207@web.de> <437CF943.7090800@lerdorf.com> <437D0D08.8060805@web.de> <437D0E22.7080006@lerdorf.com> In-Reply-To: <437D0E22.7080006@lerdorf.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] dropping curly braces From: akorthaus@web.de (Andreas Korthaus) Rasmus Lerdorf wrote: > Andreas Korthaus wrote: >> 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. OK, but by dropping {} for strings you also remove the possibility to have a convention like "[] for arrays and {} for strings". If I could decide I would drop {} for arrays and [] for strings, but I fear I will not be asked to decide... ;-) Best regards Andreas