首页 > 作文

PHP字符串函数 strstr()使用详解

更新时间:2023-04-08 13:03:20 阅读: 评论:0

定义

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 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图