note 125518 added to types.comparisons
| From: | Anonymous@php.net | Date: | Tue, 17 Nov 2020 14:24:28 +0000 |
| Subject: | note 125518 added to types.comparisons | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215858@lists.php.net to get a copy of this message | ||
I noticed that some "magic" also happens when comparing strings with leading zeros with
only two equal signs:
<?php
var_dump('1' == '01');
var_dump('01' == '000001');
?>
Output:
bool(true)
bool(true)
If the string contains only numbers all leading zeroes seem to be ignored.
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.47 (proxied: 149.224.73.80)
----
Manual Page -- http://php.net/manual/en/types.comparisons.php
Edit -- https://master.php.net/note/edit/125518
Del: integrated -- https://master.php.net/note/delete/125518/integrated
Del: useless -- https://master.php.net/note/delete/125518/useless
Del: bad code -- https://master.php.net/note/delete/125518/bad+code
Del: spam -- https://master.php.net/note/delete/125518/spam
Del: non-english -- https://master.php.net/note/delete/125518/non-english
Del: in docs -- https://master.php.net/note/delete/125518/in+docs
Del: other reasons-- https://master.php.net/note/delete/125518
Reject -- https://master.php.net/note/reject/125518
Search -- https://master.php.net/manage/user-notes.php