脚本宝典收集整理的这篇文章主要介绍了php在字符串中查找另一个字符串,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<a href="./">返回列表
<form action="<?echo $PHP_SELF;?>" method="post">
在<input tyPE="text" name="string" value="<?echo $string;?>">中查找<input type="text" name="query" value="<?echo $query;?>">
<input type="radio" name="where" value="" <?if(!isset($where) or $where=="") echo "checked";?>>第二个字符串可以在第一个字符串的任何位置
<input type="radio" name="where" value="^" <?if(isset($where) and $where=="^") echo "checked";?>>第一个字符串以第二个字符串开始
<input type="radio" name="where" value="$" <?if(isset($where) and $where=="$") echo "checked";?>>第一个字符串以第二个字符串结束
<input type="checkBox" name="case" value="case" <?if(isset($case)) echo "checked";?>>区分大小写
<input type="submIT" value="查询">
<?
if(isset($string) and isset($query) and $string<>"" and $query<>""){
if(isset($case)){
$func = "ereg";
}
else{
$func = "eregi";
}
switch($where){
case "^":
$query = "^" . $query;
break;
case "$":
$query .= "$";
break;
}
eval("$found = $func("$query","$string");");
if($found){
echo "找到!";
}
else{
echo "未找到!";
}
}
?>
以上是脚本宝典为你收集整理的php在字符串中查找另一个字符串全部内容,希望文章能够帮你解决php在字符串中查找另一个字符串所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。