>>>> >> Its a defacto standard. Of course there is nothing stopping PHP >>>> from >>>> >> implementing properties that way, but by going against the >>>> standard set >>>> >> by >>>> >> the rest of the industry, it is very confusing for programmers >>>> coming >>>> >> from >>>> >> other languages to learn PHP. A good example is how "==" works >>>> >> differently in PHP than in other languages. In PHP, "===" works >>>> like >>>> >> "==" >>>> >> does everywhere else. "(string)'0' == (int)0", for example is >>>> true in >>>> >> PHP, but false in most other languages. I have had countless >>>> >> conversations with PHP developers who claim the language is >>>> "broken", >>>> >> because == does not work like they expect it to, after which I >>>> have to >>>> >> explain === to them. This is because PHP goes against the defacto >>>> >> standard. Maybe it would have been better if == and === had the >>>> >> opposite >>>> >> meaning, as to not squash the standard? >>> > >>> > You have got me there. >>> > = is assign >>> > == is equal value >>> > === is equal type and value >>> > >>> > At least on all the languages I've been using recently ... where is >>> this a >>> > problem? >> >> In any language that does not have === it is like this: >> >> = is assign >> == is equal type and value >> >> That is where the confusion comes from. People do not expect "0" and 0 >> to >> be equal, because they are different types. > > javascript and C++ both do implicit type conversion (coercion) the same as > PHP. > You will have to prove that this is NOT the norm. There was a big debate a > long > time back on stopping implicit type conversion in C++ ... it did not get > anywhere. What I am probably asking simply because I don't know is what > language > are you referring to as I've not come across any. If it's C# then that > would > explain it ... THAT was created by people who did not accept the consensus > agreement in C/C++ ;)
Ah well you are right about implicit type conversion... that DOES exist in C#, but its not the same as how it works in PHP AFAIK. I am fairly certain that "0" == 0 in C/C++/C# would always be false, or am I incorrect? 0.0 == 0 in C# DOES return true, for the record, I suppose I forgot about that. Sorry. My brain is on overload right now :) - Dennis -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php