Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20108 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54388 invoked by uid 1010); 17 Nov 2005 23:11:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 54373 invoked from network); 17 Nov 2005 23:11:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2005 23:11:35 -0000 X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.4/2.6 Received: from ([204.11.219.139:51680] helo=colo.lerdorf.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id CD/F8-07637-62E0D734 for ; Thu, 17 Nov 2005 18:11:35 -0500 Received: from [207.126.233.18] (rasmus2.corp.yahoo.com [207.126.233.18]) (authenticated bits=0) by colo.lerdorf.com (8.13.5/8.13.5/Debian-3) with ESMTP id jAHNBUxB008274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 17 Nov 2005 15:11:31 -0800 Message-ID: <437D0E22.7080006@lerdorf.com> Date: Thu, 17 Nov 2005 15:11:30 -0800 User-Agent: Thunderbird 1.5 (Macintosh/20051025) MIME-Version: 1.0 To: Andreas Korthaus CC: internals@lists.php.net References: <437B530A.5050105@prohost.org> <437CF6B4.5080207@web.de> <437CF943.7090800@lerdorf.com> <437D0D08.8060805@web.de> In-Reply-To: <437D0D08.8060805@web.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] dropping curly braces From: rasmus@lerdorf.com (Rasmus Lerdorf) 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