You are here: Re: newline "\n" not working. « PHP Programming Language « IT news, forums, messages
Re: newline "\n" not working.

Posted by Alan Little on 05/14/06 13:59

Carved in mystic runes upon the very living rock, the last words of
stevek of comp.lang.php make plain:

> Alan Little wrote:
>> Carved in mystic runes upon the very living rock, the last words of
>> stevek of comp.lang.php make plain:
>>
>>> stevek wrote:
>>>> Following code does not produce any new lines. Any ideas.
>>>>
>>>> echo "This spans\multiple lines. The newlines will be\noutput as
>>>> well.";
>>> Sorry ... spell checker corrected some.
>>>
>>> echo "This spans\nmultiple lines. The newlines will be\noutput as
>>> well.";
>>
>> So, you're saying that this will output the literal string:
>>
>> This spans\nmultiple lines. The newlines will be\noutput as well.
>>
>> Is the bit you posted above a direct cut-and-paste from your script?
>> If not, check that you are in fact using double quotes and not
>> single.
>>
> <?php
>
> $conn = @mysql_connect( "campania", "sfk", "" )
> or die( "Sorry - could not connect to MySQL" );
> echo "$conn\n";
> //$rs1 = @mysql_create_db( $_REQUEST['db'] );
> echo "This spans\nmultiple lines. The newlines will be\noutput as
> well."; ?>
>
> produces......
>
> Resource id #2 This spans multiple lines. The newlines will be output
> as well.

If you mean it outputs this in your browser (I don't see a shebang line,
so I assume you're not running this on the command line), then Robert
gave you the answer. A newline is equivalent to a space, in HTML.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация