note 72199 deleted from language.operators.comparison by crell
| From: | crell@php.net | Date: | Wed, 30 Mar 2022 21:47:53 +0000 |
| Subject: | note 72199 deleted from language.operators.comparison by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217790@lists.php.net to get a copy of this message | ||
Note Submitter: stepheneliotdewey at gmail [period] com
----
Note that typecasting will NOT prevent the default behavior for converting two numeric strings to
numbers when comparing them.
e.g.:
<?php
if ((string) '0123' == (string) '123')
print 'equals';
else
print 'doesn\'t equal';
?>
Still prints 'equals'
As far as I can tell the only way to avoid this is to use the identity comparison operators (=== and
!==).