How to remove part of a string after last comma in PHP

php, string, substring

Solution

`substr` and `strrpos` would be useful

$until = substr($string, 0, strrpos($string.",", ","));

Note: edited based on comments below

Problem

How to remove part of a string after last comma in PHP ? String : `"this is a post, number 1, date 23, month 04, year 2012"` Expected: `"this is a post, number 1, date 23, month 04"`

Original source