Re: Strict typing

From: Date: Wed, 11 Aug 2010 14:09:03 +0000
Subject: Re: Strict typing
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-49333@lists.php.net to get a copy of this message
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. ================ <?php 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/

« previous php.internals (#49333) next »