Doc #68542 [Opn->Csd]: Relational operators semantics is different with actual behavior.
| From: | stas@php.net | Date: | Sun, 28 Jun 2015 22:47:25 +0000 |
| Subject: | Doc #68542 [Opn->Csd]: Relational operators semantics is different with actual behavior. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12487@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68542&edit=1
ID: 68542
Updated by: stas@php.net
Reported by: y dot uchiyama dot 1015 at gmail dot com
Summary: Relational operators semantics is different with
actual behavior.
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: PHP Language Specification
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of smalyshev@gmail.com
Revision: http://git.php.net/?p=php-langspec.git;a=commit;h=976a43c717d81cba08b81d5cfa2ed569979d0e2b
Log: Fixed bug #68542
Previous Comments:
------------------------------------------------------------------------
[2014-12-03 14:02:40] y dot uchiyama dot 1015 at gmail dot com
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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68542&edit=1