Re: Odd Code Error.
| From: | Chris W | Date: | Wed, 21 Jan 2004 22:32:16 +0000 |
| Subject: | Re: Odd Code Error. | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175350@lists.php.net to get a copy of this message | ||
Luke wrote:
yeah its strange, $test is equal to $test2, $test is equal to $test3 but $test2 is not equal to $test3, $test = "string"; $test2 = true; $test3 = 0; if($test == $test2){ echo "hi"; } somone tell me im wrong please? else thats seriously weirdI'm sure many will disagree with me on this but, this is EXACTLY why I think all this loose type conversion in php, perl and others, is a bad idea. An int should be an int and a string should be a string. It's not that hard to write and use functions like strtoint() and inttostr(). If you want an easy way to compare 2 strings with out the old C function strcmp(), then use operator overloading like in C++. I also think that not forcing the user to declare variables and types before they are used is also a very bad idea and will lead to far more subtle bugs than if you do use type declarations. Chris W