if we compare via "==" there is an implicit cast to the most primitive form.

These are all true, and all have a reason, and make sense:

// (int)'abc' is 0
var_dump('abc' == 0);

// 'abc' is not an empty string
var_dump('abc' == true);

// 2 is not 0, which would be casted into false, so it's true
var_dump(2 == true);

A common error is usually in MySQL queries without explicit cast comparing 
strings to numbers as well ... this is bad, specially because every programmer 
should have at least low level programming languages basis ... that can only 
help to better understand today high level programming languages.

The reason we use, love, hate PHP as loose type scripting language does not 
mean we should avoid to understand how php works internally (C)

Loose type is only manifested to the developer, but it will never be behind 
(still C)

If you use APD or you think about the low level logic behind comparing string, 
num and bool you'll probably forget the "==" operator and you'll never miss 
again the "===" one ... then you'll start to explicit cast everything, when 
necessary, to have all your code truly under control, and that is the moment 
you'll realize PHP is not for you 'cause you are forcing a typeless language to 
be strict ... and then you'll start to develop via C, Python, Java, or C#, 
ending up with JavaScript on server side 'cause is the only scripting language, 
without pretending classic OOP, that makes sense ... (sorry for the last part 
of this reply, that's just what happened to me)

Regards
                                          
_________________________________________________________________
Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail 
you.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010

Reply via email to