RE: [PHP] problem with \n

From: Date: Wed, 24 Jan 2001 08:18:07 +0000
Subject: RE: [PHP] problem with \n
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36351@lists.php.net to get a copy of this message
\n is not a new line to the browser window although if you look at the HTML source, a new line will exist. You want to use <br> here. Now to demonstrate, use pre, which values whitespace : <pre> <?php echo "top\nblah\ntext\n\n\n\nboo"; ?> </pre> At any rate, \n does not return a new line within browser window, this is common question/issue so don't fret :-). newlines are treated like any other whitespace to browser. This is why we have the function nl2br : http://www.php.net/manual/en/function.nl2br.php Using newlines allows our html source to be pretty and simpler to debug. And they are useful in such things as in email messages. Philip On Wed, 24 Jan 2001, Roman wrote: > for example echo "text1 \n"; > echo "text2 "; > and result is text1text2 > > > -----Original Message----- > From: Philip Olson [mailto:philip@cornado.com] > Sent: Wednesday, January 24, 2001 8:58 AM > To: Roman > Cc: Php-General > Subject: Re: [PHP] problem with \n > > > > > > How are you using it (code snip) and what is it not doing for you? > > Philip > > > On Wed, 24 Jan 2001, Roman wrote: > > > I have PHP 4.0.4 version but i have problem with this escape command : \n > : > > don't > > work. what's the problem another escape command work with no problems... > > > > > > Thanx, roman > > > > > > -- > > 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 (#36351) next »