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/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to