How do you debug PHP? Just with debug-prints in your script? Or is it worth installing XDebug? Is there any better debugging possiblity?
Yes, Xdebug is an good option for debugging PHP Code. I give you four class of debugging PHP Code.
I often use some combined tools to debugging PHP fastest.
There is four class for debugging php.
First is simple debug, you can use php funciton ex. var_dump, print_r.
Second is dll debug, you can use external dll library for debuging ontime i.e. xdebug, zend_debug.
Third is framework debug, some tool is design specially for its framework i.e. zend_log, cakephp logging, symfony logging.
Fourth is php debug, it's is written in plain php, no belong to any framework i.e. Kint, Log.Vkit, dbug.
You can try all class. After a period time, you can combine some tools in them that is suitable for yourself.
There are some alternatives to consider from (licensed, trail, open-source). Start with choosing one and look at debugging techniques for PHP.
I have listed references below to look at all mentioned tips:
Xdebug is the easiest option and many IDEs have very simple setup procedures because it's so common and useful. I would not dream of coding anything in PHP without it. Not only can you see what the variables are, you can watch them change as you step forwards, then set conditional breakpoints so that e.g. you only stop a loop when a variable matches the value you're interested in. You can also look at different parts of the program during the same page load and set particular variables onto a watch list so you can easily see how they change whilst ignoring the others.
There's just no way to get enough print_r() calls into your script (as well as take them out again afterwards) to be that useful without sacrificing huge amounts of time.