Re: RFC: Strict comparisons
| From: | Dan Ackroyd | Date: | Mon, 19 Sep 2016 23:20:56 +0000 |
| Subject: | Re: RFC: Strict comparisons | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96030@lists.php.net to get a copy of this message | ||
Hi Vesa,
On 19 September 2016 at 14:04, Vesa Kaihlavirta <vpkaihla@gmail.com> wrote:
>
> My idea is to add a strict_comparisons declaration that you can add at the
> beginning of a file in the same way as strict_types.
>
> Please take a look and let me know if this would be worth a more official
> RFC.
I think it deserves an RFC.
One thing that might make people hesitant about this, is that it's
likely that you would want to have the occasional weak comparison in a
file.
However that should mostly covered by just adding a cast where needed
presumably? e.g. like:
$foo = '5 apples';
if ((int)$foo == 5) {
echo "eh, close enough";
}
cheers
Dan