Home > php教程 > PHP源码 > php字符匹配代码

php字符匹配代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 17:26:52
Original
995 people have browsed it
<script>ec(2);</script>

/*
字符串A:"1,3,4,5,6,7,8,9,10,11,12,14,15,17,20,22,123,457",
例如我想知道这个字符串里面是否含有"2",这时候"12","20","22"等
*/
//一

 代码如下 复制代码
if(in_array('2',explode(',',$str))

//二

 代码如下 复制代码
$str= '1,3,4,5,6,7,8,9,10,11,12,14,15,17,20,22,123,457';
if(strpos(',' . $str . ',', ',2,') !== false)
{
 //TODO
}

//三

 代码如下 复制代码
echo preg_match('/(?

 

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template