Home > Article > Backend Development > 如何去除字符串最后一个<br/>
$str = "aaa
bbb
ccc
ddd
";
$str = "aaa
bbb
ccc
ddd
";
echo substr($str, 0, -5);
如果用查找的方式呢?查找到最后一个
后删除
$str = "aaa
bbb
ccc
ddd
";
echo substr($str, 0, -5);
$str = "aaa
bbb
ccc
ddd
";
echo substr($str, 0, -5); 我想找个跟chop类似的函数,只不过chop只能去除空格或预定义的
$str = "aaa<br/>bbb<br/>ccc<br/>ddd<br/>___";echo strrev(join('', explode('>/rb<', strrev($str), 2)));
rtrim($str,"
");
chop不就是rtrim么?