Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84414 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26205 invoked from network); 7 Mar 2015 20:02:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2015 20:02:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=bostjan@a2o.si; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bostjan@a2o.si; sender-id=pass Received-SPF: pass (pb1.pair.com: domain a2o.si designates 78.47.12.76 as permitted sender) X-PHP-List-Original-Sender: bostjan@a2o.si X-Host-Fingerprint: 78.47.12.76 portkey.s.itsis.si Received: from [78.47.12.76] ([78.47.12.76:43283] helo=portkey.s.itsis.si) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/10-25467-1695BF45 for ; Sat, 07 Mar 2015 15:02:42 -0500 Received: from undisclosed (undisclosed [127.0.0.254]) (Authenticated sender: undisclosed) by portkey.s.itsis.si (Postfix) with ESMTPSA id 3767E8006B for ; Sat, 7 Mar 2015 20:02:37 +0000 (UTC) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.98.6 at portkey Received: by iery20 with SMTP id y20so647648ier.11 for ; Sat, 07 Mar 2015 12:02:35 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.107.167.145 with SMTP id q139mr37160585ioe.16.1425758555515; Sat, 07 Mar 2015 12:02:35 -0800 (PST) Received: by 10.50.250.179 with HTTP; Sat, 7 Mar 2015 12:02:35 -0800 (PST) In-Reply-To: References: Date: Sat, 7 Mar 2015 21:02:35 +0100 Message-ID: To: Kalle Sommer Nielsen Cc: "Sebastian B.-Hagensen" , reeze , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a114299903cb2580510b8481f Subject: Re: [PHP-DEV] [Discussion] Deprecate function sizeof() From: bostjan@a2o.si (Bostjan Skufca) --001a114299903cb2580510b8481f Content-Type: text/plain; charset=UTF-8 On 7 March 2015 at 20:42, Kalle Sommer Nielsen wrote: > Hi > > Well we could make count()/sizeof() work for strings, so that if: > C:\> php -r "echo sizeof('abc');" > 3 > > although it would not really accomplish much imo., I think it is more > of what background you come from that makes the most sense to me, I > got into PHP before C and I enjoy sizeof more for array sizes than > count, but that is just a pure preference. > Maybe count() and sizeof() should retain original functionality for the sake of compatibility, but should emit warning if used on non-array/object variables? This seems like a gentle way to steer users towards using strlen() on strings. Using sizeof(null) seems somewhat legitimate, but sizeof("asdf") seems like a newbie mistake at counting characters in a string. b. PS: All above assumes the functionality of sizeof() does not change. If sizeof() functionality should be changed to be more aligned with it's C counterpart, then above argument does not stand. --001a114299903cb2580510b8481f--