Re: When is "z" != "z" ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin Alterisio wrote:
I still don't see why this functionality should be a native operator of the language. It doesn't seem natural that ++ operator "understands" that the string could be an enumeration of some kind. I believe that such things should be left to the coder who knows what the string is really representing, not to the language.

That's the strictly typed argument. If you always force people to declare their types and you never automatically convert them, then you have a strictly typed language. You have the same thing happening for something like:

 echo "2"+"3";

In a strictly typed language that would spew an error. In a loosely typed language like PHP you get 5

And yes, I agree that ++ on strings is getting near the edge of that, but there has to be an edge somewhere and not everyone is going to agree on exactly where to draw the line.

-Rasmus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux