View Single Post
Old 05-15-2013, 04:06 PM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,091
Quote:
Originally Posted by Colmike7 View Post
Oh. Is there a simpler one line way to do it like trim, but for the entire string, or was the solution already posted above?
replace is the easiest way. However, in this case it would seem to me that there is some disagreement on what needs to be replaced. The OP says the phrase comes out on 2 lines. If it is an html presentation that would indicate that there is a <br> in the phrase. If it is a text presentation that would indicate that there is a carriage return/linefeed in the phrase.

If he needs to get rid of a <br> then strip_tags does that or you could include it in a replace. If he needs to get rid of a carriage return/linefeed then the replace can do that. Since we don't know exactly which needs to be done then a solution like dankasaur's that covers both possibilities will work.

A one line solution would be like

<?php print str_replace(array("\r\n","\r","<br>")," ",$hi->hello); ?>

.
__________________
All cookies cleared!

Last edited by sarettah; 05-15-2013 at 04:12 PM..
sarettah is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote