News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Working Software Blog:
Parsing the output of PHPs print_r function
January 14, 2011 @ 12:19:00

On the Working Software blog there's a recent post looking at correcting a mistake that the developer made when choosing the logging method of his application - pushing the output of print_r into a file.

recently deployed a job on which the timeline was so tight that my ability to type quickly was what made the difference between delivering on time or not. Everything was rushed, the budget was tight, it was one of those real seat of the pants deals and there was far too little testing done. [...] The only problem is that, in the 5 minutes before the site was supposed to go live, I didn't really have much time to thoughtfully prepare a logging system to record all this stuff and, in my haste, I settled for [a file_put_contents of the print_r of $_GET and $_POST].

Obviously, this solution is useful for casual browsing of the information, but if you need any real data from it, it's a real chore. To help you with the task, they've put together a snippet of code that can work through your print_r output and return it in a much more handy line-by-line result. Full code is copy-and-paste ready in the post.

1 comment voice your opinion now!
printr log file parse output


blog comments powered by Disqus

Similar Posts

Michelangelo van Dam's Blog: Quality Assurance on PHP projects - PHPDocumentor

NETTUTS.com: CodeIgniter from Scratch: File Uploading and Image Manipulation

PHPit.net: Creating a file manager with PHP

DevShed: Handling File Data with PHP (Reading & Seeking)

Zend Developer Zone: SQLite: Lean, Mean DB Machine


Community Events





Don't see your event here?
Let us know!


laravel community opinion podcast language list testing configure refactor install unittest release introduction series framework developer symfony2 code threedevsandamaybe interview

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework