3 ms·
I think you got the logic on empty backward :) Right now empty('0') is true - meaning php thinks it's empty (because '0' turns into 0 which turn into false). I
by ars 18y ago
I think you got the logic on empty backward :)
Right now empty('0') is true - meaning php thinks it's empty (because '0' turns into 0 which turn into false). I think it should be the other way around, and so do you except you read what I wrote backwards.
And I understand the problem of '0007' - but 'abc' == 0 is worse. Most of the time things in php are strings. If you know you'll have leading zeros, then you also know it once was a string, and you'll take measures like intVal. You need intVal to avoid SQL injection attacks anyway.