RE: [PHP] converting str with \n to one line str??

From: Date: Tue, 21 Aug 2001 13:12:57 +0000
Subject: RE: [PHP] converting str with \n to one line str??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63696@lists.php.net to get a copy of this message
I usualy work on chr() I whould have done for the \n: $temp = str_replace(chr(10),"test",$temp) and for the \r\n $temp = str_replace( chr(13).chr(10) ,"test",$temp) but my experience tells me it's \n\r not \r\n I use the $temp = str_replace( chr(10).chr(13) ,"test",$temp) have a nice day eichert > -----Original Message----- > From: Dave [mailto:dave@hawk-systems.com] > Sent: Dienstag, 21. August 2001 14:40 > To: Jens Schodt; 'Tyler Longren' > Cc: php-general@lists.php.net > Subject: RE: [PHP] converting str with \n to one line str?? > > > try "\r\n" (return and new line) Have had to use this when parsing cisco > output... uses both not just newlines. > > Dave > >-----Original Message----- > >From: Jens Schodt [mailto:js@e-sense.dk] > >Sent: Tuesday, August 21, 2001 3:20 AM > >To: 'Tyler Longren' > >Cc: 'php-general@lists.php.net' > >Subject: SV: [PHP] converting str with \n to one line str?? > > > > > > > >$temp = str_replace("\n","test",$temp) is doing the same thing. > It is still > >a string in several lines if you look in the source :-( > > > >jens > > > >-----Oprindelig meddelelse----- > >Fra: Tyler Longren [mailto:tyler@captainjack.com] > >Sendt: 20. august 2001 20:20 > >Til: Jens > >Cc: php-general@lists.php.net > >Emne: Re: [PHP] converting str with \n to one line str?? > > > > > >You could use str_replace(). > > > >-- > >Tyler Longren > >Captain Jack Communications > >tyler@captainjack.com > >www.captainjack.com > > > > > > > >On Mon, 20 Aug 2001 20:15:54 +0200 > >"Jens" <nice@email.dk> wrote: > > > >> When I use Javascript with PHP i run into one problem. When I get the > >> data i > >> need from the database it often has a lot of <br> and \n (new lines) in > >> it. > >> The <br> are no problem when converting a string to a > Javascript string, > >> but > >> the \n are. The string has to be all in one line. > >> > >> example: > >> <? $temp = "here > >> I > >> am"; ?> > >> > >> <script>var temp = <? echo $temp?> </script> > >> > >> This is not working!! But this would : > >> > >> <? $temp = "here I am"; ?> > >> > >> <script>var temp = '<? echo $temp?>'; </script> > >> > >> Can you help me please? > >> > >> thanks Jens > >> > >> > >> > >> > >> -- > >> 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 > > > >-- > >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 > > > > > > > > > -- > 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 (#63696) next »