brown2005 Posted January 21, 2011 Share Posted January 21, 2011 $string = " hel lo "; $string = rtrim($string); $string= ltrim($string); which trims the whitespace from the front and back, but how do i remove the middle space? Thanks Link to comment https://forums.phpfreaks.com/topic/225193-trim-whitespace-in-a-string/ Share on other sites More sharing options...
Valakai Posted January 21, 2011 Share Posted January 21, 2011 str_replace(' ', '', $text); Link to comment https://forums.phpfreaks.com/topic/225193-trim-whitespace-in-a-string/#findComment-1163044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.