How do you debug PHP scripts?
I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in PHPEclipse is also quite useful.
What is the best (in terms of fast and easy) way to debug in phpStorm or any other IDE?
How do you debug PHP scripts?
I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in PHPEclipse is also quite useful.
What is the best (in terms of fast and easy) way to debug in phpStorm or any other IDE?
The integrated debuggers where you can watch the values of variable change as you step through code are really cool. They do, however, require software setup on the server and a certain amount of configuration on the client. Both of which require periodic maintenance to keep in good working order.
A print_r is easy to write and is guaranteed to work in any setup.
PhpEdit has a built in debugger, but I usually end up using echo(); and print_r(); the old fashioned way!!
Well, to some degree it depends on where things are going south. That's the first thing I try to isolate, and then I'll use echo/print_r() as necessary.
NB: You guys know that you can pass true as a second argument to print_r() and it'll return the output instead of printing it? E.g.:
print_r( debug_backtrace() );
or something like that :-)
This is my little debug environment:
In all honesty, a combination of print and print_r() to print out the variables. I know that many prefer to use other more advanced methods but I find this the easiest to use.
I will say that I didn't fully appreciate this until I did some Microprocessor programming at Uni and was not able to use even this.