Jump to content


Photo

Pretty printing php arrays with print_r


  • Please log in to reply
1 reply to this topic

#1 arianhojat

arianhojat
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 20 October 2006 - 08:34 PM

i output an array to html with print_r($array) func. Anyway to get it nicely formatted?

thanks

if not anyone got a recursive function i can try?

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 20 October 2006 - 08:40 PM

This is an improvement over just print_r()

echo '<pre>', print_r($array, true), '</pre>';

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users