![]() |
|
[PHP] how to "pretty print" var dumps - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183) +---- Thread: [PHP] how to "pretty print" var dumps (/showthread.php?tid=5817493) Pages: Pages
1
2
|
how to "pretty print" var dumps - yrnGarry - Mar 28, 2018 How to make your var dumps/arrays come out a lot nicer for debugging. PHP Code Code array(2) {The more eye appealing way to do this would be PHP Code Code ArrayRE: how to "pretty print" var dumps - Hexi - Mar 29, 2018 Just get xDebug, it will output it nicely :) RE: how to "pretty print" var dumps - Nachfolger - Mar 29, 2018 (Mar 29, 2018 01:42 PM)Hexi Wrote: Just get xDebug, it will output it nicely :)Installiing an entire extension just to use print_r a few times during debug? No thanks. RE: how to "pretty print" var dumps - Quad - Mar 30, 2018 Setting Content-Type to text/plain does this. Otherwise, as you already did, wrapping the output in <pre>'s is probably the best way to go. Alternatively you might be able to replace \n with <br> by fiddling around with output buffering a bit. RE: how to "pretty print" var dumps - Sakuto - Mar 30, 2018 (Mar 29, 2018 02:58 PM)Nachfolger Wrote: Installiing an entire extension just to use print_r a few times during debug? No thanks. Installing an extension dedicated to debugging instead of debugging by outputting information and datas directly on page, well, it actually sounds like a good idea... RE: how to "pretty print" var dumps - Nachfolger - Apr 1, 2018 (Mar 30, 2018 03:48 PM)Sakuto Wrote: Installing an extension dedicated to debugging instead of debugging by outputting information and datas directly on page, well, it actually sounds like a good idea...Maybe for your projects you need this, but I've very rarely needed to use serious debugging methods to figure out my errors or such. I'm also on a shared host, so I don't have an option to install extensions of my choosing. Not that I would, anyway. I usually find the bugs within my queries or whatever when I take a 10m break and come back. RE: how to "pretty print" var dumps - Sakuto - Apr 1, 2018 (Apr 1, 2018 06:06 AM)Nachfolger Wrote: Maybe for your projects you need this, but I've very rarely needed to use serious debugging methods to figure out my errors or such. I'm also on a shared host, so I don't have an option to install extensions of my choosing. Well, tbh, if you debug on production server, you have problem way more serious than not being able to use debugger. RE: how to "pretty print" var dumps - yrnGarry - Apr 1, 2018 (Apr 1, 2018 09:55 AM)Sakuto Wrote: Well, tbh, if you debug on production server, you have problem way more serious than not being able to use debugger. Can you fuck off? You are the most disrespectful and arrogant asshole I’ve ever met online. [warn] RE: how to "pretty print" var dumps - Quad - Apr 1, 2018 (Apr 1, 2018 09:57 AM)yrnGarry Wrote: Can you fuck off? You are the most disrespectful and arrogant asshole I’ve ever met online. You should listen to what he has to say and not dismiss him because of his tone. Debugging in production is actually very bad. RE: how to "pretty print" var dumps - Charger - Apr 1, 2018 (Apr 1, 2018 09:57 AM)yrnGarry Wrote: Can you fuck off? You are the most disrespectful and arrogant asshole I’ve ever met online. He’s right. You shouldn’t do development debugging in a production environment. Have a test/dev, staging (mirror of production), and production environment. RE: how to "pretty print" var dumps - yrnGarry - Apr 1, 2018 (Apr 1, 2018 11:02 AM)Charger Wrote: He’s right. You shouldn’t do development debugging in a production environment. Have a test/dev, staging (mirror of production), and production environment. I didn’t say he was wrong. He negged me because HE didn’t find this helpful and that really annoys me RE: how to "pretty print" var dumps - Sakuto - Apr 1, 2018 (Apr 1, 2018 11:03 AM)yrnGarry Wrote: I didn’t say he was wrong. He negged me because HE didn’t find this helpful and that really annoys me Well, actually it's more because NONE of your """tutorial""" is useful / right. Telling bullshit and writing tutorial on it is not enough to pretend to be qualified. RE: how to "pretty print" var dumps - Sakuto - Apr 1, 2018 (Apr 1, 2018 11:08 AM)yrnGarry Wrote: You are an asshole, they are aimed towards beginners. If you weren’t a beginner then you should have clicked off you cancerous shit head Well, let me explain it in simple word. That's not because they're aimed towards beginners that they can be FALSE and teach them BAD HABITS. It's even the opposite, that's because they're aimed to beginners that they should be accurate and high quality. It's simple, don't overestimate your skills. RE: how to "pretty print" var dumps - yrnGarry - Apr 1, 2018 (Apr 1, 2018 11:10 AM)Sakuto Wrote: Well, let me explain it in simple word. It is all correct, and they are actually good habits RE: how to "pretty print" var dumps - Nachfolger - Apr 1, 2018 (Apr 1, 2018 11:02 AM)Quad Wrote: You should listen to what he has to say and not dismiss him because of his tone. Debugging in production is actually very bad.Of course it's bad. But he's the one who mentioned it. Not op, nor I. No one was even talking about debugging in production, unless it was deleted or I missed it. |