Debugging PHP Scripts
Mar 17, 2008 · 1 minute readCategory: phpdebugging
This is post is now quite old and the the information it contains may be out of date or innacurate.
If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub
In this kind of situation, it is often neccessary to go through the flow of the script and view the contents of the various strings and arrays at that stage of the script.
I have written this small function to help in this process:
function dbug($item){
echo '<hr><h3>Debug Info</h3><pre>' . (var_export($item, true)) . '</pre><hr>';
}
This script will take any item and print out detailed information for you in a nicely formatted and easy to read way.
For an example when you might decide to use this functionality, you could check the contents of your $_POST
<?php
/*very top of script */
dbug($_POST);