note 126542 added to control-structures.match
| From: | tm at main dot php dot net | Date: | Thu, 28 Oct 2021 15:02:06 +0000 |
| Subject: | note 126542 added to control-structures.match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217122@lists.php.net to get a copy of this message | ||
If you are using a match expression for non-identity checks as described above make sure whatever
you are using is actually returning
true on success.
Quite often you rely on truthy vs. falsy when using if conditions and that will not work for match
(for example preg_match). Casting to bool will solve this issue.
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 212.87.152.42)
----
Manual Page -- https://php.net/manual/en/control-structures.match.php
Edit -- https://main.php.net/note/edit/126542
Del: integrated -- https://main.php.net/note/delete/126542/integrated
Del: useless -- https://main.php.net/note/delete/126542/useless
Del: bad code -- https://main.php.net/note/delete/126542/bad+code
Del: spam -- https://main.php.net/note/delete/126542/spam
Del: non-english -- https://main.php.net/note/delete/126542/non-english
Del: in docs -- https://main.php.net/note/delete/126542/in+docs
Del: other reasons-- https://main.php.net/note/delete/126542
Reject -- https://main.php.net/note/reject/126542
Search -- https://main.php.net/manage/user-notes.php