从字符串末尾删除

19 浏览
0 Comments

从字符串末尾删除

正如标题所说,我有一个类似这样的字符串:

$string = "Hello Worldhello world";

我想要去掉字符串末尾的
标签,使其变为:

$string = "Hello Worldhello world";

我尝试了以下代码:

preg_replace('/^()*/', "", $string);

但并没有起作用。

也许有人知道正确的正则表达式。

0