About the simplest way to accomplish what you want is :

<pre>
<?php print_r($var) ?>
</pre>

\newlines don't show up in browser but will in the source, check your html
source and see how pretty it is (full of newlines).

Here's an example :

  $string = "a\nb\nc\n";

  print $string;        (newlines in source)
  print nl2br($string); (newlines and <br>'s in source)

Regarding print_r(), use <pre> as suggested above or you _could_ do other
things but we'll worry about later :)

Regards,
Philip

On Thu, 23 Aug 2001, james wrote:

> When I print an array out with print_r (php 4.06 on IIS 4.0) it does not
> print newlines even if newlines are embedded in the array element.  I must
> embed <br>, instead.
> 
> The manual examples use \n and the output shows that newlines are created.
> 
> Am I missing something?
> 
> Newbie, here.  Hope this is the right thread for such question.
> 
> Thanx,
> James
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to