【发布时间】:2012-06-07 09:20:53
【问题描述】:
如何在 PHP 中删除最后一个逗号后的部分字符串?
字符串:"this is a post, number 1, date 23, month 04, year 2012"
预期:"this is a post, number 1, date 23, month 04"
【问题讨论】:
-
使用 strrpos (php.net/manual/en/function.strrpos.php) 搜索逗号,然后搜索子字符串。