note 109373 deleted from language.operators.comparison by cmb

From: Date: Sun, 08 Dec 2019 11:33:08 +0000
Subject: note 109373 deleted from language.operators.comparison by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213470@lists.php.net to get a copy of this message
Note Submitter: toader_alexandru at yahoo dot com ---- it looks that if you check 0 against a string with == then PHP returns true: php -r 'var_dump(0 == "statuses");' -> returns TRUE but not if your string has a number at the beginning: php -r 'var_dump(0 == "2statuses");' -> returns FALSE from the specs I get it that it attempts a conversion - in this case the string to number. so better use === as always :)

« previous php.notes (#213470) next »