I want to remove everything(including the comma) from the first comma of a string in php eg.
$print=\"50 days,7 hours\";
should become \"50
This should work for you:
$r = (strstr($print, ',') ? substr($print, 0, strpos($print, ',')) : $print); # $r contains everything before the comma, and the entire string if no comma is present