Re: == and ===
| From: | Sara Golemon | Date: | Mon, 18 Apr 2005 18:58:52 +0000 |
| Subject: | Re: == and === | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-16020@lists.php.net to get a copy of this message | ||
> Just came across this:
> http://bugs.php.net/bug.php?id=23110
>
> I've been programming PHP since PHP 3
> and wasn't even aware of this behavior.
>
And now you are.
PHP is a loosely typed language. Odds are it's one of the things which
attracted you to it in the first place.
> "Numeric strings"? What is that?
>
Roughly speaking, a string matching the pattern:
/^(-\d)?\d*(.[0-9]*)?(E[+-]\d+)?/
Though that's not precisely how the engine handles it internally.
> if ($typedPassword == $password) doSomeAdministrativeTaskHere();
>
> You better not use '000000001' as password, or '0e00.0000', since
> people would be able to use '' (yes, empty string!) to hack your app.
>
Quick! Go change your password!