note 125443 deleted from function.preg-match by cmb
| From: | cmb@php.net | Date: | Sun, 18 Oct 2020 10:59:34 +0000 |
| Subject: | note 125443 deleted from function.preg-match by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215604@lists.php.net to get a copy of this message | ||
Note Submitter: PHP Guru
----
preg_match() returns 1 if the pattern matches given subject, 0 if it does not, or FALSE if an error
occurred.
Since an error may occur unexpectedly, you should always check for a boolean false to avoid common
security pitfalls:
$return_value = preg_match(...);
if ($return_value===false) {
throw new Error('preg_match failed unexpectedly.');
}