note 46745 added to function.print-r
| From: | killar at gamingsanctum dot com | Date: | Thu, 21 Oct 2004 22:52:00 +0000 |
| Subject: | note 46745 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-78914@lists.php.net to get a copy of this message | ||
When printing an array, NEVER FORGET THE <pre> TAGS. If you do not use them, you will get a
printout of the entire array on one line.
Example:
<?
$test123 = array('the', 'wrong', 'way');
print_r($test123);
?>
Will give
Array ( [0] => the [1] => wrong [2] => way )
While:
<?
$test123 = array('the', 'right', 'way');
echo '<pre>';
print_r($test123);
echo '</pre>';
?>
Will give:
Array
(
[0] => the
[1] => right
[2] => way
)
Keep that in mind. It really helped me with debugging.
----
Manual Page -- http://www.php.net/manual/en/function.print-r.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46745
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46745&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46745&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46745&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46745&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46745&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46745&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46745&report=yes
Search -- http://master.php.net/manage/user-notes.php