Umm... just spaces? Sure...
for($i = 5; $i < strlen($data); $i++) {
if($data{$i} != chr(32) && $data{$i} != chr(160)) continue; else {
$data = substr($data, 0, $i);
break;
}
}
Note that my above code checks for normal spaces and non-breaking spaces (ALT+0160 or ' ' in HTML).
The $data_short variable is the shortened string in this code.