HomePHP Debugging Program Flow with the Xdebug Extension
Debugging Program Flow with the Xdebug Extension
The Xdebug PHP extension combines a set of powerful functions with an easy learning curve. This appealing mixture turns it into the choice of many PHP developers for debugging PHP applications with a great level of detail. If you want to learn how to get the most out of this debugging library without having to spend long hours reading its user manual, then keep reading. In this seven-part series of articles you’ll find an approachable guide to utilizing its most important functions. I will use numerous code samples to instruct you in the use of the Xdebug extension.
Of course, if you already read the previous tutorial of the series, then you're already familiar with using a few simple, yet useful, functions provided by the Xdebug extension, such the popular “var_dump()” function. As you’ll possibly recall, the extension offers an enhanced version of this function that lets you get detailed information about one or more PHP variables.
What’s more, when used with an object, the “var_dump()” function permits you to retrieve a complete set of parameters, including the name of the properties of the targeted object, and their types and values. This feature can be pretty useful when debugging object-based PHP programs.
Nonetheless, the X-debug extension comes equipped with many other functions that allow you to perform all sorts of debugging tasks. So, provided that you’re interested in learning a bit more, in this fourth article I’ll be explaining how to use the complementary “xdebug_start_code_coverage()” and “xdebug_get_code_coverage()” functions. They can help you keep track of which lines are executed by a specified PHP program.
The usage of these functions is very interesting, trust me, so don’t waste more time in preliminaries. Start reading about them now!