php remove multiple spaces from start and end of string code example Example: remove double space php $ro = preg_replace('/\s+/', ' ',$row['message']);