On Wed, 26 Jun 2019 at 12:46, Benjamin Morel <benjamin.mo...@gmail.com> wrote:
> This makes sense for "<", "<=", ">", ">=", but what about "==" and "!="? > > Currently, "11" == "11.0"; what would this yield under the new proposal? > > - leave it as is: return true in this case => contradicts the whole purpose > of the new proposal > - throw a TypeError when performing the above comparison => not acceptable > either I guess; every language allows == and != on strings, forcing to use > strict comparison operators is a bit weird here. > - change the semantics to return false when both operands are strings, and > don't match => not acceptable to you as you cannot know what a line of code > does without checking the header > Given that we already have === and !==, could the strict mode simply throw an error for *any* use of the non-strict == and != versions? declare(strict_operators=1); var_dump( "11" == "11.0" ); # TypeError: "Cannot use non-strict equality operator in strict operator mode." var_dump( "11" === "11.0"); # bool(false) I'm not sure whether I like the idea or not, but I thought I'd throw it out there as a possibility. Regards, -- Rowan Collins [IMSoP]