Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20131 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17933 invoked by uid 1010); 18 Nov 2005 07:52:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 17917 invoked from network); 18 Nov 2005 07:52:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2005 07:52:18 -0000 X-Host-Fingerprint: 195.197.172.115 gw01.mail.saunalahti.fi Linux 2.4/2.6 Received: from ([195.197.172.115:50309] helo=gw01.mail.saunalahti.fi) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 6B/4C-07637-2388D734 for ; Fri, 18 Nov 2005 02:52:18 -0500 Received: from nest.netphobia.fi (YZDCXXXI.dsl.saunalahti.fi [85.76.35.232]) by gw01.mail.saunalahti.fi (Postfix) with ESMTP id A4270100690; Fri, 18 Nov 2005 09:52:11 +0200 (EET) Received: from nest.netphobia.fi (nest.netphobia.fi [127.0.0.1]) by nest.netphobia.fi (8.13.1/8.13.1) with ESMTP id jAI7qCAx004331; Fri, 18 Nov 2005 09:52:12 +0200 Received: from localhost (jani@localhost) by nest.netphobia.fi (8.13.1/8.13.1/Submit) with ESMTP id jAI7qBbZ004328; Fri, 18 Nov 2005 09:52:12 +0200 X-Authentication-Warning: nest.netphobia.fi: jani owned process doing -bs Date: Fri, 18 Nov 2005 09:52:11 +0200 (EET) Reply-To: Jani Taskinen To: Rasmus Lerdorf cc: Andreas Korthaus , internals@lists.php.net In-Reply-To: <437D0E22.7080006@lerdorf.com> Message-ID: References: <437B530A.5050105@prohost.org> <437CF6B4.5080207@web.de> <437CF943.7090800@lerdorf.com> <437D0D08.8060805@web.de> <437D0E22.7080006@lerdorf.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: Re: [PHP-DEV] dropping curly braces From: sniper@iki.fi (Jani Taskinen) Just a friendly note from my PHP user side: We had 2 places where {} where used for accessing string. Took me 10 seconds to remove those with the help of the nice E_STRICT error. (filename, linenumber) --Jani On Thu, 17 Nov 2005, Rasmus Lerdorf wrote: > > 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 > >