Debugging PHP Scripts
Today nobody really questions benefits of using source level debuggers for any language including PHP - debugger is simply a tool, necessity in everyday programmers work. However, it is interesting to note that code validating tools are much less known and it is those tools that are very valuable addition to debuggers in code development.
Traditionally, in compiled languages, certain part of code validation (type checking, checking for non-initialized variables) are usually taken by compiler, but besides compiler there are also external tools used to conduct this task (for example checkstyle for Java). This article deals with use of those tools during development of PHP applications (we will be using Codenizer).
Basic question that programmer asks herself/himself when introducing one new tool into development process is "What benefit can I expect from using this?". Answer to this question is very simple - it is dramatic time saver during development, and we all know what that means in today's world of merciless business competition - more time you save in development of one application faster you can switch to next application, which means more money for you.
Code verification/checking tools are complementary to debuggers - usual way of using debugger is after encountering program malfunction to better analyze reasons that led to unexpected behavior and in the end to eliminate those reasons (i.e. bugs). On the other hand, code verification tools are used during program development to pinpoint possible problematic locations which could eventually lead to bugs in program - so debuggers are used to eliminate bugs once they are in program, code validation tools are used to prevent bugs from appearing in the program in the first place.
To better illustrate basic operation of validating tools let's consider this simple PHP script (schedule.php, given with line numbers to be easier to follow):
As we can see in the report are mentioned 3 potentially problematic spots which should be closer inspected by programmer:
First of all you need tool itself (like Codenizer), then some IDE that supports PHP development (Eclipse or NetBeans would be smart choice), and plugin for integrating tool with IDE which can be found in the same location as tool.
It would be wrong to think of code validation as of some magic that would forever relieve you of using debugger and make you make bug-free code. Code validation can't do that for you, but what it can do is to reduce your time spent debugging program by almost 80% and it can help you spot the problems that could otherwise go unseen for very long time.
Re: Debugging PHP Scripts
the best IDE which I prefer is Zend Studio.
WAMP or IIS? Hmmm, I prefer to use XAMPP
Regarding debugging, you can try Zend Core/Zend Plateform to debug your PHP application in Zend Studio.
Web conference software
|All times are GMT +5.5. The time now is 05:09.|