一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

php 判断字符串包含指定字符

时间:2010-08-16 编辑:简简单单 来源:一聚教程网

//实例一

 代码如下 复制代码
    $string="i am abc";
    if (ereg ("www.111com.net", $string)) echo "'abc' is true

";                  
    if (ereg ("^abc", $string)) echo "'^abc' is true

";                  
    if (ereg ("abc$", $string)) echo "'abc$' is true";

//实例二

 

 代码如下 复制代码
     $string = "this is a test. that is another test.";
     echo ereg_replace (" is", "  was", $string)."

";
     echo ereg_replace (" is", " is", $string)."

";
     echo ereg_replace ("test", "test", $string);

热门栏目