Home  >  Article  >  Backend Development  >  php finds another string in a string_PHP tutorial

php finds another string in a string_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:49:11812browse

Return to list


Find ">

>The second string can be anywhere in the first string

>The first string starts with the second string> ;The first string ends with the second string

>Case sensitive



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; func("$query","$string");");
 if($found){
 echo "Found! ";
 }
 else{
 echo "Not found! ";
 }
}
?>


http://www.bkjia.com/PHPjc/319564.html

truehttp: //www.bkjia.com/PHPjc/319564.htmlTechArticlea href="./"Return to list/abr form action="?echo $PHP_SELF;?" method= "post" finds input type="text" name="query" value="?e...
Statement:
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