oreilly.comSafari Books Online.Conferences.


NuSphere's IDE for PHP Programmers
Pages: 1, 2

A look at the debugger

PHPEd's debugger is clearly the tool's major selling point. To understand how useful a debugger can be, consider an example that can be found in most every Web application: you collect some data via browser form inputs that need to be validated, manipulated (perhaps by stripping tags, changing special characters to HTML entities, etc.), and then inserted into a database. What do you do if the process does not go as you expected and there's an error in the code that you need to track down? It's possible that the error lies in any one of several files or any one of many functions. Without a debugger, all you can do is insert echo statements at the likely problem spots and re-run the script. This tedious process can go on for a while before you find the source of the problem.

The PHPEd debugger allows you to follow a script, through all of its includes and functions, and track the values of variables at each stage. With the debugger you can step through the script and at each step, you can see how variables are responding to conditionals and functions.

There are two ways to view variable values in the debugger. You can put a "watch" on a variable name and see how the value changes in the debugger window. Or you can simply roll your mouse over a variable and see the value at that stage of the script. Figures 5 and 6 show both of these methods.

Figure 5.

Screen shot
Figure 6.

The debugger also allows you step over and out of portions of your application, allowing you to focus in on only the problematic portions of your script.

PHPEd's debugger is not perfect. Array values don't always display properly in the debugger window, but it does deal with scalar variables and objects well.

Working with MySQL

NuSphere is primarily a database company that has been working with MySQL. So it should be no surprise that PHPEd comes with tools that help integrate PHP with the MySQL database. If you are a MySQL user, these features are pretty convenient, as you can get information on your schema and data without having to open up phpMyadmin or the MySQL command-line client.

For starters, you'll be able browse through all of the databases and tables available to your server. From the database window (Figure 7), you can copy database and table names and paste them into your scripts, thereby cutting down on potential typing errors.

Screen shot.
Figure 7.

Additionally, you can look at the details of specific tables -- including table structures, field names, data types, and live data. Figures 8 and 9 show three different views of a single table in PHPEd.

Screen shot.
Figure 8.

Screen shot.
Figure 9.

You can also run arbitrary queries against a MySQL database. There's no longer a need to open a separate application when it comes time to debug queries. You can simply paste the query into a form and see the data that is returned. (Figure 10).

Screen shot.
Figure 10.

It would be nice for many PHP developers if PHPEd could integrate with other databases -- PostgreSQL support, in particular, would be nice. IDEs on other platforms support helpful features like dynamic query building that are not available here.

Is it worth the switch?

At US$299, PHPEd is probably more expensive than your current text editor, but if you're looking for a tool that can help you develop PHP faster, PHPEd may well be worth the investment. The text editor, debugger, and MySQL features will make life just a bit easier and the coding day just a bit shorter.

Jay Greenspan is a contributing author for Apple Developer Connection.

Return to

Sponsored by: