RE: [PHP] Re: string formatting help

From: Date: Fri, 06 Jul 2001 20:47:16 +0000
Subject: RE: [PHP] Re: string formatting help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-56574@lists.php.net to get a copy of this message
Yeah, I was seeing them. And when I stripped them out and replaced them with white space, it still broke in those places, it'd look like: kdjsakdasja dsakjaskjsa dsakaskj But I got it fixed.. $RESPONSE = addslashes($row[RESPONSE]); $OVERLIBBED = str_replace(chr(13), "", $RESPONSE); $OVERLIBBED = str_replace(chr(10), "", $OVERLIBBED); is what worked for me .. Thanks all, Chad -----Original Message----- From: Steve Edberg [mailto:sbedberg@ucdavis.edu] Sent: Friday, July 06, 2001 4:29 PM To: Chad Day; php-general@lists.php.net Subject: [PHP] Re: string formatting help In the original message below, did you mean that you're actually SEEING the <br> tags in the output? If so, there may be a conversion with htmlentities() going on somewhere that converts the <br> tags to &lt;br&gt; (so they are displayed instead of being interpreted). If you replaced the <br>'s with spaces or newlines, the output _should_ all be on one line, since HTML considers ALL strings of whitespace (tabs, newlines, returns, spaces) to be a single space. If you replaced <br>'s with newlines and you are getting the line breaks still, your output may be in a <pre>...</pre> block. - steve At 3:36 PM -0300 7/6/01, "InÈrcia Sensorial" <inerte@hotmail.com> wrote: > Maybe: > >$array = explode("<br>", $string); > >foreach ($array as $key => $value) { > echo "$value"; >} > > Would separate the string by <br>'s and print all in one line. > Or, more compactly: echo str_replace('<br>', '', $string); This would only work if tags were lowercased; to handle mixed case, you'd need to do echo eregi_replace('<br>', '', $string); or use the preg equivalent > Julio Nobrega. > >A hora est· chegando: >http://sourceforge.net/projects/toca > >"Chad Day" <cday@atpco.com> wrote in message >news:NFBBLNJBKLPPMKEJAKCOEEJNCHAA.cday@atpco.com... >> I'm trying to pull a string from a database to use in a javascript >> function.. but it's doing line breaks on me, which in turn messes up the >> javascript. >> >> The string in the mysql db is like: >> kjdsakjadk<br>skjdks<br><br>kjkdfjdfkjfd >> >> When I pull it out, it becomes: >> >> kjdsakjadk >> <br> >> skjdks >> <br> >> <br> >> kjkdfjdfkjfd >> >> I've tried replacing the br's with blank spaces or new line characters, >but >> in the html code it still breaks on those breaks when I echo it back out. >> How can I force this string to be all on one line? >> >> Thanks, > > Chad >> -- +------ Factoid: Of the 100 largest economies in the world, 51 are ------+ | Steve Edberg University of California, Davis | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +--- corporations ------ http://www.ips-dc.org/reports/top200text.htm ---+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#56574) next »