note 115920 deleted from function.preg-match by cmb
| From: | cmb@php.net | Date: | Sun, 04 Dec 2016 12:07:14 +0000 |
| Subject: | note 115920 deleted from function.preg-match by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208183@lists.php.net to get a copy of this message | ||
Note Submitter: Supriya Karmakar Kolkata
----
Always escape double quotes to avoid errors, even if you don't need to.
bad practice:
$foo = preg_match('/<h2 class="bengali">.*?<\/h2>/', $bigTextChunk,
$myArray);
good practice:
$foo = preg_match("/<h2 class=\"bengali\">.*?<\/h2>/", bigTextChunk,
$myArray);
Bad practice can cause mysterious errors as it happened in my case.