是否有可能在PHP,以确定是否预浸模式是有效的
问题描述:
的preg_match()将返回是否有可能在PHP,以确定是否预浸模式是有效的
preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash
如果没有很好地形成图案。是否有函数来确定(TRUE或FALSE)模式是否合格在之前传递preg_match()?
答
$match = preg_match('regex', 'string');
if ($match === false) {
// failed
} elseif ($match == false) {
// did not matched
} else {
// matched
}
尝试阅读文档> http://php.net/manual/bg/function.preg-match.php如果有错误,它将返回False。 – Svetoslav