如何在 PHP 中删除部分字符串? [英] How can I remove part of a string in PHP?

查看:31
本文介绍了如何在 PHP 中删除部分字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何删除字符串的一部分?

How can I remove part of a string?

示例字符串:REGISTER 11223344 here"

如何从上面的示例字符串中删除 "11223344" ?

How can I remove "11223344" from the above example string?

推荐答案

如果您专门针对11223344",请使用 str_replace:

If you're specifically targetting "11223344", then use str_replace:

// str_replace($search, $replace, $subject)
echo str_replace("11223344", "","REGISTER 11223344 here");

这篇关于如何在 PHP 中删除部分字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆