note 127428 added to language.operators.comparison

From: Date: Sat, 06 Aug 2022 13:05:56 +0000
Subject: note 127428 added to language.operators.comparison
Groups: php.notes 
Request: Send a blank email to php-notes+get-219378@lists.php.net to get a copy of this message
Please be careful when you try to compare strings that have a plus sign + at the beginning (such as phone number, etc). When you use the Equal operator == PHP will ignore the plus sign. Use Identical operator === instead Example: $str1 = "62"; $str2 = "+62"; var_dump($str1 == $str2); // bool(true) var_dump($str1 === $str2); // bool(false) ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.163 (proxied: 125.164.234.198) ---- Manual Page -- https://php.net/manual/en/language.operators.comparison.php Edit -- https://main.php.net/note/edit/127428 Del: integrated -- https://main.php.net/note/delete/127428/integrated Del: useless -- https://main.php.net/note/delete/127428/useless Del: bad code -- https://main.php.net/note/delete/127428/bad+code Del: spam -- https://main.php.net/note/delete/127428/spam Del: non-english -- https://main.php.net/note/delete/127428/non-english Del: in docs -- https://main.php.net/note/delete/127428/in+docs Del: other reasons-- https://main.php.net/note/delete/127428 Reject -- https://main.php.net/note/reject/127428 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219378) next »