CoreyR Posted March 7, 2007 Share Posted March 7, 2007 The snip below prints "1245 Long Tree Dr" How do I make it, print "1245LongTreeDr"? while($info = mysql_fetch_array( $data )) { Print "".$info['address'].""; } Thanks in advance Link to comment https://forums.phpfreaks.com/topic/41553-solved-question-about-removing-all-spacing-in-a-string/ Share on other sites More sharing options...
redarrow Posted March 7, 2007 Share Posted March 7, 2007 <?php $text=str_replace(" ","",$info['address']); ?> example ok <?php $info=array("address"=>" hi the i am redarrow"); $text=str_replace(" ","",$info['address']); echo $text; ?> Link to comment https://forums.phpfreaks.com/topic/41553-solved-question-about-removing-all-spacing-in-a-string/#findComment-201386 Share on other sites More sharing options...
CoreyR Posted March 7, 2007 Author Share Posted March 7, 2007 Wow, thanks for the help! Link to comment https://forums.phpfreaks.com/topic/41553-solved-question-about-removing-all-spacing-in-a-string/#findComment-201401 Share on other sites More sharing options...
neo777ph Posted March 7, 2007 Share Posted March 7, 2007 use the trim function ex. trim($var); Link to comment https://forums.phpfreaks.com/topic/41553-solved-question-about-removing-all-spacing-in-a-string/#findComment-201407 Share on other sites More sharing options...
kenrbnsn Posted March 7, 2007 Share Posted March 7, 2007 No, the trim() function will only remove whitespace from the ends of the string, not from the whole string. Ken Link to comment https://forums.phpfreaks.com/topic/41553-solved-question-about-removing-all-spacing-in-a-string/#findComment-201429 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.