Re: Don't compare zero exponentials in strings as equal
| From: | Kamil Tekiela | Date: | Thu, 04 Mar 2021 11:45:36 +0000 |
| Subject: | Re: Don't compare zero exponentials in strings as equal | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-113367@lists.php.net to get a copy of this message | ||
I actually do a lot of lexicographical comparison with ISO8601 date
strings.
I also have numerical string comparisons, but the truth is I didn't think
they would be cast to integers so that is a potential bug in my code. When
I use < on strings I expect that they will both compare as strings. In
other places, I explicitly cast one or both operands to integers or float.
I do see the problem that many people could use < and > on strings
expecting numerical comparison, but I believe most people expect
lexicographical comparison like me.