note 55149 deleted from function.preg-match by felipe
| From: | felipe@php.net | Date: | Mon, 10 Dec 2007 01:42:23 +0000 |
| Subject: | note 55149 deleted from function.preg-match by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133073@lists.php.net to get a copy of this message | ||
Note Submitter: hippiejohn1020 --- attT --- yahoo.com
----
Watch out when using c-style comments around a preg_match or preg_* for that matter. In certain
situations (like example below) the result will not be as expected. This one is of course easy to
catch but worth noting.
/*
we will comment out this section
if (preg_match ("/anything.*/", $var)) {
code here;
}
*/
This is (I believe) because comments are interpreted first when parsing the code (and they should
be). So in the preg_match the asterisk (*) and the ending delimiter (/) are interpreted as the end
of the comment and the rest of your (supposedly commented) code is intrepreted as php.