【函数功能】
该函数搜索字符串在指定字符串中的第一次出现。
	【函数语法】
strstr ($haystack, $needle, $before_needle = null)
	【参数说明】
$haystack:必需,要被搜索的字符串。
$needle:必需,要搜索的字符串,如果此参数是数字,则搜索匹配此数字对应的 ASCII 值的字符。
$before_needle:可选,默认值为 "false" ,如果设置为 "true",它将返回 $needle 参数第一次出现之前的字符串部分。
	【演示程序】
<?php
        /**
         * strstr ($haystack, $needle, $before_needle = null)
         * **/
        $haystack = "Hello i am PHP!";
        echo strstr($haystack, "i");//采用默认参数
        echo "<br>";
        echo strstr($haystack, "i",true);
        echo "<br>";
        echo strstr($haystack, 105);
?>
	【输出结果】
i am PHP!
Hello 
i am PHP!
	【特别注意】
1.该函数是二进制安全的。
2.该函数对大小写敏感。
3.PHP 版本:4+。
4.更新日志:在 PHP 5.3 中,新增了 before_search 参数。
5.若未找到指定字符串则返回false。
	【原版定义】
/**
 * Find the first occurrence of a string
 * @link http://www.php.net/manual/en/function.strstr.php
 * @param haystack string <p>
 * The input string.
 * </p>
 * @param needle mixed <p>
 * If needle is not a string, it is converted to
 * an integer and applied as the ordinal value of a character.
 * </p>
 * @param before_needle bool[optional] <p>
 * If true, strstr returns
 * the part of the haystack before the first
 * occurrence of the needle (excluding the needle).
 * </p>
 * @return string the portion of string, or false if needle
 * is not found.
 */
转载请注明出处:php1234.cn ,原文地址:http://www.php1234.cn/a/functions/2016/1011/88.html