gpt4 book ai didi

php - 从字符串中删除前两个单词

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:51:49 26 4
gpt4 key购买 nike

我有一个字符串:

$string = "R 124 This is my message";

有时,字符串可能会发生变化,例如:

$string = "R 1345255 This is another message";

使用 PHP,删除前两个“单词”(例如,开头的“R”和随后的数字)的最佳方法是什么?

感谢您的帮助!

最佳答案

$string = explode (' ', $string, 3);
$string = $string[2];

必须比正则表达式快得多。

关于php - 从字符串中删除前两个单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1225948/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com