Re: print_r question
| From: | Philip Olson | Date: | Thu, 23 Aug 2001 21:23:30 +0000 |
| Subject: | Re: print_r question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64178@lists.php.net to get a copy of this message | ||
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: 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
>