Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49333 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18106 invoked from network); 11 Aug 2010 14:09:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2010 14:09:09 -0000 Authentication-Results: pb1.pair.com header.from=brian@moonspot.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=brian@moonspot.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain moonspot.net designates 72.5.90.27 as permitted sender) X-PHP-List-Original-Sender: brian@moonspot.net X-Host-Fingerprint: 72.5.90.27 smtp.dealnews.com Linux 2.5 (sometimes 2.4) (4) Received: from [72.5.90.27] ([72.5.90.27:59337] helo=smtp.dealnews.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/B2-01618-30FA26C4 for ; Wed, 11 Aug 2010 10:09:08 -0400 Received: (qmail 7062 invoked from network); 11 Aug 2010 14:08:59 -0000 Received: from unknown (HELO mail.dealnews.com) (10.1.10.7) by -H with ESMTPS (DHE-RSA-AES256-SHA encrypted); 11 Aug 2010 14:08:59 -0000 Received: (qmail 23354 invoked from network); 11 Aug 2010 14:09:04 -0000 Received: from h105.248.18.98.static.ip.windstream.net (HELO macdough.local) (brianm@98.18.248.105) by -H with ESMTPA; 11 Aug 2010 14:09:04 -0000 Message-ID: <4C62AEFF.2030400@moonspot.net> Date: Wed, 11 Aug 2010 09:09:03 -0500 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 To: Zeev Suraski CC: Stas Malyshev , =?UTF-8?B?Sm9oYW5uZXMgU2NobMO8?= =?UTF-8?B?dGVy?= , Kalle Sommer Nielsen , Internals , Derick Rethans References: <1281478269.6608.292.camel@guybrush> <4C61D6FB.6030108@sugarcrm.com> <7.0.1.0.2.20100811085214.0f024300@zend.com> In-Reply-To: <7.0.1.0.2.20100811085214.0f024300@zend.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Strict typing From: brian@moonspot.net (Brian Moon) On 8/11/10 1:03 AM, Zeev Suraski wrote: > We've also had quite a lengthy discussion on this topic, and there > was more support for 'weak' typing then there was for strict typing. Yes, I would like to restate the obvious from my email in May: > Really, I am confused what the argument is about. We already decided > how this should work years ago. It should work just like the code > below. Having user land functions work different than built in > functions is the most confusing thing you can do. Unless of course > someone plans on fixing all the internal functions too. > > ================ > > > error_reporting(E_ALL); > > $int = 1.25454; > > $var = substr($int, 0, 4); > > var_dump($var); > > $var = round($var, 1); > > var_dump($var); > > $arr = array(); > > $var = substr($arr, 0, 1); > > var_dump($var); > > $text = "test"; > > $var = round($text, 1); > > var_dump($var); > > ?> > > $ php test.php > string(4) "1.25" > float(1.3) > > Warning: substr() expects parameter 1 to be string, array given in > /Users/brianm/test.php on line 17 > NULL > float(0) -- Brian. -------- http://brian.moonspot.net/