note 107178 deleted from function.preg-quote by peehaa

From: Date: Mon, 09 Dec 2013 11:42:55 +0000
Subject: note 107178 deleted from function.preg-quote by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197847@lists.php.net to get a copy of this message
Note Submitter: billadoid at gmail dot com ---- If you need to quote everything but a wildcard, maybe this function will come handy to you: <?php protected function _ruleOptionIsMatched($option, $subject) { $option = preg_quote($option, '#'); $option = str_replace('\*', '.*', $option); if(preg_match("#^$option$#", $subject)) { return true; } else { return false; } } ?>

« previous php.notes (#197847) next »