函式:preg_match() |
preg_match字串比对剖析。 语法: int preg_match(string pattern, string subject, array [matches]); 传回值: 整数/阵列 函式种类: 资料处理
本函式以 pattern 的规则来剖析比对字串 subject。比对结果传回的值放在阵列参数 matches 之中,matches[0] 内容就是原字串 subject、matches[1] 为第一个合乎规则的字串、matches[2] 就是第二个合乎规则的字串,余类推。若省略参数 matches,则只是单纯地比对,找到则传回值为 true。
|