note 110349 deleted from function.assert by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 12:17:01 +0000 |
| Subject: | note 110349 deleted from function.assert by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197137@lists.php.net to get a copy of this message | ||
Note Submitter: Sony?
----
If you would like to compare with === or !== you need to add '(string)' before string
numbers. Or wrap them with quotes.
<?php
$stringNumber = "2";
$number = 2;
assert($stringNumber ." === ". $number); //True (!!!) :(
assert("(string)". $stringNumber ." === ". $number); //False, as we wanted. :)
assert("'". $stringNumber ."' === ". $number); //Also false :)
?>