Published on 2007-02-12 20:59:11
The solution is in reality inspired from FirePHP and my old Buggy PHP class, but more simplified to track time consumption in your code :
Usage of the class is simply by setting different $module names to every part that you would like to track. Let say :
And in Firebug you have this message in console :
I simply altered the page with some JavaScript, and from PHP you can enable disable debugging message. Now we can add more advanced features for example we can track PHP errors inside Firebug and here is a more complete example :
And below a screenshot of how results looks like in Firebug :
You can also have a look on the link I have provided in the beginning and see how to include SQL queries. Saving debug data in database is very long story that I didn't wanted to talk about here but this will give you lots of ideas to improve your application, you can for example retrieve debug info via AJAX and visualize graphics... etc. Let me know if you have any comment or suggestion.
Member of the PHP Magazine Network, Copyright (C) 2005-2008 phpmagazine.net All Rights Reserved