HomePHP Working with the X-debug extension`s var_dump() function
Working with the X-debug extension`s var_dump() function
If you’re a PHP developer who’s searching for an approachable guide to using the most relevant functions that come bundled with the X-debug extension, then look no further. Welcome to the third article of a series on debugging in PHP with the X-debug extension. Comprised of seven tutorials, this series teaches you how to utilize the features that come with the X-debug library to debug your own PHP applications.
And speaking of the debugging features included with X-debug, in the last article I discussed how to use the library's "xdebug_call_function()" method for determining from which function a method or statement was called during the execution of a PHP script.
In that tutorial, this function was called from within the API of a basic sample class, but it's also possible to invoke it from a procedural application and obtain the same results.
Nevertheless, the X-debug extension comes with many other functions that allow you to debug PHP programs with a greater level of detail than simply informing you of what function was called by a script, or at which line a method was invoked. That's why I'm drawing your attention now to its "var_dump()" function.
As you may know, "var_dump()" is a PHP native function, but the X-debug library provides an enhanced version of it that's capable of retrieving much more information about a supplied variable. These capabilities greatly extend its usefulness in debugging. Therefore, in this third article of the series I'll teach you how to use this function, as usual by way of illustrative code samples.
Now, it's time to get rid of the preliminaries and see how to utilize the improved version of the "var_dump()" PHP built-in function, this time to get relevant information on a specified variable. Let's get going!