V5.3.0 新增可选的 before_needle 参数。
V4.3.0 strstr() 成为二进制安全的。
strstr (string $haystack , mixed $needle [, bool $before_needle = FALSE ] )
返回 haystack 字符串从 needle 第一次出现的位置开始到 haystack 结尾的字符串。
该函数区分大小写。如果想要不区分大小写,请使用 stristr()。
如果你仅仅想确定 needle 是否存在于 haystack 中,请使用速度更快、耗费内存更少的 strpos() 函数。
$email = 'name@example.com';$domain = strstr($email, '@');echo $domain; // 打印 @example.comecho "<br/>";$user = strstr($email, '@', true); // 从 PHP 5.3.0 起echo $user; // 打印 name
原文链接:http://www.cnblogs.com/jc2182/p/11846975.html
本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728