php中判断字符串肇端和结束

WBOY
Release: 2016-06-13 11:03:03
Original
1007 people have browsed it

php中判断字符串开头和结束
    $str="/*zone adlidi lkdjoaihdn laidfhoh k23980ejnml ll;i;*/"
//判断字符串是否以“/*”开头
     if (preg_match("/^\/\*/",$str)){
     echo "true";
     }else{
     echo "false";
     }
//判断字符串是否以“/*”结束   
     if (preg_match("/\*\/$/",$str)){
     echo "true";
     }else{
     echo "false";
     }

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template