shadiadiph Posted June 11, 2010 Share Posted June 11, 2010 I am using implode to turn an array into a string I can't figure out why but in the new string the text seems to jump down a line in several places anyone had this problem i just tried to str_replace "\r" with a space and it made no difference anyone got any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/204494-implode-causing-annoying-line-breaks-in-a-string/ Share on other sites More sharing options...
JasonLewis Posted June 11, 2010 Share Posted June 11, 2010 What's the array? What are you trying to glue it together with? Quote Link to comment https://forums.phpfreaks.com/topic/204494-implode-causing-annoying-line-breaks-in-a-string/#findComment-1070807 Share on other sites More sharing options...
shadiadiph Posted June 11, 2010 Author Share Posted June 11, 2010 the array is a list of cities the problem seems to be with city names that have a space like El Paso turns out like El Paso I have tried glueing it with a comma with || also get the same result. Quote Link to comment https://forums.phpfreaks.com/topic/204494-implode-causing-annoying-line-breaks-in-a-string/#findComment-1070808 Share on other sites More sharing options...
premiso Posted June 11, 2010 Share Posted June 11, 2010 $string = implode(", ", $array); $string = str_replace(array("\n", "\r"), "", $string); Should take care of the jumpy ness, unless it is being caused by whitespaces. Quote Link to comment https://forums.phpfreaks.com/topic/204494-implode-causing-annoying-line-breaks-in-a-string/#findComment-1070809 Share on other sites More sharing options...
shadiadiph Posted June 11, 2010 Author Share Posted June 11, 2010 thanks premiso worked great Quote Link to comment https://forums.phpfreaks.com/topic/204494-implode-causing-annoying-line-breaks-in-a-string/#findComment-1070810 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.