print_r() not working properly?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
HiddenS3crets
Forum Contributor
Posts: 119
Joined: Fri Apr 22, 2005 12:23 pm
Location: USA

print_r() not working properly?

Post by HiddenS3crets »

When I use print_r() to display an array, it does not put in the proper line breaks and indents like it should. Instead it is all on one line like:
Array( [0] => 'hi' [1] => 'bye' );

How can I make it so it's like:
Array
(
[0] => 'hi'
[1] => 'bye'
)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Code: Select all

echo '<pre>';
print_r($array);
echo '</pre>';
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Hint: You may want to check the source code :idea:

EDIT: scottayy was faster than me (1 min) and gave you the solution :P
Post Reply