On 19 September 2016 14:04:48 BST, Vesa Kaihlavirta <vpkai...@gmail.com> wrote:
>My idea is to add a strict_comparisons declaration that you can add at
>beginning of a file in the same way as strict_types. The effect would
>that all normal comparisons would make a type check before doing the
>comparison, and throw a TypeError exception if the types don't match.

Hm, that's definitely an interesting idea. It occurs to me that there are a few 
things to "being strict" beyond type equality.

For instance === will also (I think) stop PHP juggling *both sides* of a 
comparison, e.g. two numeric strings will sometimes be compared numerically 
rather than bytewise.

Using if statements with non-booleans also feels closely related - should the 
setting (or another new flag?) throw an error on if($foo) being implicitly 
processed as if(empty($foo))?


Rowan Collins

PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to