Re: Array functions with strict comparison
| From: | Craig Francis | Date: | Tue, 14 Nov 2023 18:03:02 +0000 |
| Subject: | Re: Array functions with strict comparison | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121674@lists.php.net to get a copy of this message | ||
On 14 Nov 2023, at 17:49, Robert Landers <landers.robert@gmail.com> wrote:
> One of the most beautiful things about PHP is that null == 0 == false, or '5' == 5 ==
> 5.0, or 1 == true == 'hello world', which is so incredibly handy in web-dev that to ignore
> it is inviting bugs. Headers may or may not be set, form values may or may not be set, JSON
> documents may or may not be missing keys/values, etc. How everything is coerced is extremely well
> documented and very obvious after working with PHP for a while.
Sorry, can't help myself... unless you dare to pass NULL to trim(), or urlencode(), or
htmlspecialchars(), or preg_match(), etc, etc.
:-)
Craig