PHP求字符串的长度 部分正则表达式

来源:互联网 发布:磁力搜索 知乎 编辑:程序博客网 时间:2024/05/12 07:39
function strLength($string){$array  = preg_split('/(?<!^)(?!$)/u',$string);return count($array);}       固话       $result = preg_match("/^(0(10|21|22|23|[1-9][0-9]{2})(-|))?[0-9]{7,8}$/", $phone,$match);       移动电话       $result = preg_match("/^((\(\d{3}\))|(\d{3}\-))?1\d{10}$/", $phone,$match);       邮箱       strlen($email) > 6 && preg_match("/^[\w\-\.]+@[\w\-]+(\.\w+)+$/", $email)       URL地址       preg_match("/^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"])*$/", $str);   

0 0