asmith Posted August 18, 2008 Share Posted August 18, 2008 Hey Is there any php built-in function to make all spaces in the entire paragraph into one ? for example : $a = "This text will become to this "; the output become this : $a = "This text will become to this "; Link to comment https://forums.phpfreaks.com/topic/120178-solved-making-all-spaces-into-one/ Share on other sites More sharing options...
JonnoTheDev Posted August 18, 2008 Share Posted August 18, 2008 $string = "This text will become to this "; $string = preg_replace('/ {2,}/', ' ', $string); print $string; Link to comment https://forums.phpfreaks.com/topic/120178-solved-making-all-spaces-into-one/#findComment-619102 Share on other sites More sharing options...
asmith Posted August 18, 2008 Author Share Posted August 18, 2008 Thanks man I had completely forgotten preg_replace Link to comment https://forums.phpfreaks.com/topic/120178-solved-making-all-spaces-into-one/#findComment-619103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.