strpos<?php
$mystring = 'abc';
$findme   = 'a';
$pos = strpos($mystring, $findme);// Note our use of ===.  Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
    echo "The string '$findme' was not found in the string '$mystring'";
} else {
    echo "The string '$findme' was found in the string '$mystring'";
    echo " and exists at position $pos";
}// We can search for the character, ignoring anything before the offset
$newstring = 'abcdef abcdef';
$pos = strpos($newstring, 'a', 1); // $pos = 7, not 0
?>

解决方案 »

  1.   

    strpos($b, $a);
    //返回a在b中的位置,如果没有就返回FLASE
      

  2.   

    以前有人问过相同的问题。解决方法就是在前面一个函数中制定一个标志变量。willko(珂[新手]->努力学习)(07毕业,求深圳PHP工作)说的那个程序,不错,你读懂里面的意思之后,就可以用了
      

  3.   

    楼主问的是是否包含另外一个变量中$b的字符, 
    strpos是包含整个字符串