strstr – 按分隔符截取字符串
strstr ( string $haystack , mixed $needle [, bool $before_needle = fal ] ) : string
返回 haystack 字符串从 needle 第一次出现的位英文对联置开始到 haystack 结尾的字符串。包括needle。
不存在则返回fal。
如果仅仅想确定 needle 是否存在于 haystack 中,可以使用速度更快、耗费内存更少的 strpos() 函数。
before_needle
如果为true,则返回 needle 在 haystack 中的位置之前的部分,不包括needle。
<?php$email = 'name@example.com';$domain = strstr($email, '@');echo $domain; // @example.com$us普通话考试文章er = s福临门冬虫夏草胶囊trstr($email, '@', true); // 从 php 5.3.0 起echo $ur; // name,不包含@?>不折不挠;
本文发布于:2023-04-08 13:03:18,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/d57ac7e526b0958b6e65213e39ade707.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:PHP字符串函数 strstr()使用详解.doc
本文 PDF 下载地址:PHP字符串函数 strstr()使用详解.pdf
留言与评论(共有 0 条评论) |