Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Unexpected behavior of int vs bool
August 30, 2010, 1:29 am
rate this thread
I was very surprised to find the following while debugging.
// Consider this simple function.
for ($i = 10; $i >= $n; $i--) echo "Loop $i\n";
// I accidentally passed False (or NULL) to code like that.
This results in an infinite loop!
This is not a bug. It is working exactly as documented.
And I learned not to assume type conversions work as expected.