php使用strstr函数 ,判断字符串A中是否含有字符串B

<?php

//例如:字符串A $a= “中华人民wan sui wan sui wan wan sui!”;

        //想知道这个字符串中是否含有 中华 或者 wan sui

//可以作如下判断

$a = "中华人民wan sui wan sui wan wan sui!";

if(strstr($a,"中华") && strstr($a,"wan sui")){

echo "<br />字符串A中含有中华和wan sui";

}

?>

 

posted on 2013-05-13 16:27  风林幻海  阅读(381)  评论(0编辑  收藏  举报

导航