Re: New to PHP question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/1/28 Stephen <stephen-d@xxxxxxxxxx>:
> Don Collier wrote:
>>
>> I am just learning PHP from the O'Reilly "Learning PHP 5" book and I have
>> a question regarding the formatting of text.  Actually it is a couple of
>> questions.
>>
>> First, when I use the \n and run the script from the command line it works
>> great.  When I run the same code in a browser it does not put the newline in
>> and the text runs together.  I know that I can use <br/> to do the same
>> thing, but why is it this way?
>>
>> The second question is closely related to the first.  When formatting text
>> using printf the padding works great when running from the command line but
>> not at all when in a browser.
>> Here is the code that I am working with:
>>
> Browsers **only** support HTML.
>
> They do not understand things like "\n" to be anything special, so they just
> print as it is sent to the browser.

<?php
    header('Content-Type: text/plain');
    echo "That's\n";
    echo "Not\n";
    echo "Entirely\n";
    echo "Accurate.";
?>

-Stuart

-- 
http://stut.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux