【发布时间】:2020-10-09 13:15:04
【问题描述】:
如何在 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) 搜索逗号,然后搜索子字符串。