Hi Björn,
Björn Larsson wrote:
Den 2016-03-24 kl. 21:29, skrev Andrea Faulds:
Came to think on a conversation with Sara G last year about introducing
the following operators, namely >==, <== & <==> working exactly like the
existing ones but without type juggling.
Maybe that would alleviate some of the issue here, giving new tools at
hand when writing new or updating existing code?
This is an interesting idea. === and !== avoid type juggling by
returning FALSE if the types of their operands don't match, so what
would these hypothetical strict versions of < and > do in that
situation? One approach would be to order by type, so any integer < any
float < any string, for example. I think I'd like that, it'd be more
predictable than PHP's current comparison operators, where "1" < "a" <
"b" < 1 < "2" < 2.
I'm not sure about those symbols, though. Given their appearance I'd
think >== and <== would be strict versions of >= and <=, even though I
think you're proposing them to be strict versions of > and <. But surely
something could be figured out.
Thanks!
--
Andrea Faulds
https://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php