Using Debugging and Unit Testing tools with your PHP application: Introduction
For most of us, our introduction to PHP was pretty simple. Usually it was a website page, where the code flowed from top to bottom in a nice, orderly, procedural path. After all, that’s how it worked with HTML, so it should work fine with PHP.
Fast forward to today and there is a lot of code out there that is still done exactly this way, where everything is in order just like the old HTML pages of yore. However, PHP now has the ability (and has for some time) to use Object Oriented Programming Standards. Now anyone that has been in the industry (or has done a CS degree in the last five years or so) should know of the benefits of having your code done in an object orientated fashion, but for PHP developers, trying to debug your OO code has been an adventure. One on par to having your teeth pulled with noÂ aesthetic.
With this setup, you will be able to debug code regardless of its complexity, by using breakpoints to start and stop code execution, seeing how your code performs at certain stages, and finding out why things may, or may not be working as intended. Youll also be able to write tests to make sure that your code works as intended, and can easily be retested to ensure changes to your code havent caused anything to break. Also error messages will give you a rundown of the chain of execution that led to the error occurring, showing a better idea of where the actual piece of buggy code is located.
So if youre tired of having to put echo statements everywhere to figure out where your OO code is misbehaving, this walkthrough is definitely for you. Well go through setting up an entire development environment that will be based on your system, and be able to develop and debug code more effectively. Here are all the articles in order of publication.