strstr 显示出现之前的字符串

发布于 2024-08-06 05:57:40 字数 281 浏览 4 评论 0 原文

我想像这样获取针出现后字符串的第一位...

$user = strstr('[email protected]', '@', true); 

但这仅适用于 PHP 版本 5.3.0,我有 5.2.9 有什么办法可以得到相同的结果吗?

I want to get the first bit of the string after the occurrence of the needle like this...

$user = strstr('[email protected]', '@', true); 

But this only works with PHP Version 5.3.0, I have 5.2.9
Is there a way I can get the same results?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

滥情空心 2024-08-13 05:57:40
list($user, $therest) = explode('@',$email);
list($user, $therest) = explode('@',$email);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文