|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-06-28 22:47 UTC] stas@php.net
[2015-06-28 22:47 UTC] stas@php.net
-Status: Open
+Status: Closed
[2015-06-28 23:20 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 05:00:01 2025 UTC |
Description: ------------ The semantics of relational operators (in 10-expressions.md) is different with the actual behavior of PHP, in case that both operands are string (the semantics says rules 2 and 4 are applied). In this case, numeric comparison is applied only if both operands are numeric string without overflow, otherwise lexical comparison is applied. Some examples are shown below. echo ('1' == '0x1') . "\n"; // true echo ('1' == '1a') . "\n"; // false echo ('1234567890' == '1234567890.0') . "\n"; // true echo ('123456789012345678901234567890' == '123456789012345678901234567890.0') . "\n"; // false echo ('1e10' == '1.0e10') . "\n"; // true echo ('1e1000' == '1.0e1000') . "\n"; // false