Technology TidBits

Answers to various technical questions on php programming, mysql, linux, and many more categories.



Add comment:
Name:
Email:
Comment: *
(Use BBcode - No HTML)


You MUST answer this simple math equation - to prevent spammers: 9 + 10 =  


How can I format my php print_r statements to be more readable in html?

Last updated: 07/01/2009

Normally print_r spits out an array with out any html linebreaks, so in a web browser, it is hard to see what your array looks like.  I just throw in this little function to clean up the output:

 

function print_r_html ($arr) {
        ?><pre><?
        print_r($arr);
        ?></pre><?
}

Just call it with "print_r_html($array);" for quick debugging of your scripts.





Powered by KnowledgebasePublisher 1.1
Superb Internet
Content provided by Roberts WebForge, Inc.