note 115920 added to function.preg-match
| From: | SupriyaKarmakarKolkata | Date: | Tue, 14 Oct 2014 17:34:56 +0000 |
| Subject: | note 115920 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-200646@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 103.21.58.61
Probable Submitter: 103.240.96.225
----
Manual Page -- http://php.net/manual/en/function.preg-match.php
Edit -- https://master.php.net/note/edit/115920
Del: integrated -- https://master.php.net/note/delete/115920/integrated
Del: useless -- https://master.php.net/note/delete/115920/useless
Del: bad code -- https://master.php.net/note/delete/115920/bad+code
Del: spam -- https://master.php.net/note/delete/115920/spam
Del: non-english -- https://master.php.net/note/delete/115920/non-english
Del: in docs -- https://master.php.net/note/delete/115920/in+docs
Del: other reasons-- https://master.php.net/note/delete/115920
Reject -- https://master.php.net/note/reject/115920
Search -- https://master.php.net/manage/user-notes.php