[eluser]BrianDHall[/eluser]
[quote author="überfuzz" date="1254842539"][quote author="n0xie" date="1254838447"]Then you haven't worked much with dynamically typed languages.
For most dynamically typed language it works the same (at least the ones I am familiar with: PHP, Python, Ruby, Perl and TCL ):
Code:
(int) 0 = (string) '0' = (float) 0.00 = (bool) FALSE
(int) 1 = (string) '1' = (float) 1.00 = (bool) TRUE
[/quote]
Resumé: I started out with C++ and JAVA. I pretty sure C++ was type-safe, not sure of JAVA. But it was consider veeeeery bad practice to alter types. Teacher vent: >:-([/quote]
Yeah, this is one of those love-it-or-hate-it things. PHP doesn't really care what type a variable is unless you call for type-casting. I've only run into it a couple of times in the last five years, but if you aren't aware of the functioning it can be really hard to figure out what is up with the magic.
If you just assume everything is a string or integer and rely on PHP's own evaluation of what is true and false rather than trying to be very explicit about what you are looking for you tend to almost never run into the problem.
But when you are used to lower level languages like C++ or Java its hard not to try to be thinking about what type a variable is. One of the upsides/downsides of coding in PHP is you tend to just not think about it.