Coding and Debugging: Demonstrated Strength
Coding and debugging is where the strength of Zend Studio lies. It should really make life easier for PHP developers. The first thing that you'll love is the code completion.
shows code completion in action for the simplest PHP program there is: a one-line phpinfo()
call. Simply typing 'phpi
' calls this beauty up, and not only can you get a code completion but also a brief help snippet on the selected function. No more thumbing through manuals or testing for bugs when you are trying to remember if you should be using mysql_select_rows
|Figure 4. Completion Elation: The code completion feature is worth the cost of the IDE all on its own.|
One thing that could be improved is the breadth of what is available from these dropdowns. So if, for example, you don't have the MySQL libraries enabled in your instance of PHP they'll still appear on the list as soon as you type 'my
'. For PHP extensions that aren't enabled by default (in your PHP.INI file), such as 'ImageJpeg
', this can be both misleading and annoying. If you make an ImageJpeg
command in a PHP file, the inline help and autocomplete will register it and encourage you to use it, but when you run, you get an error due to a call to an undefined function. It would be nice if the mini help (see Figure 4
) would tell you the extension that is needed to run it or perhaps only give you what is available to you based on your preferences defined in php.ini
Zend Studio's debugging is really nice. Just as with any other major IDE, you can now set breakpoints and watches on your PHP. This alone is worth the price of the IDE, as I don't know how many hours I have spent debugging an application with endless echo($var)
commands until I had sorted out a bug. Not only that, but Zend comes with a debug server that you can deploy your page to and if it is called by an external source, it will jump into your IDE in debug mode. Anybody who has ever coded a PayPal IPN site will understand the joy that this will bring you!
|Author's Note: With PayPal IPN, whenever a payment goes in our out of your site, PayPal posts data to a page that you specify. Because you don't explicitly run this page yourself, it is very difficult to debug.
The only gripe I have with debugging is that the default Debug Output window outputs raw text or HTML code (see Figure 5
) rather than rendered previews. When developing Web sites it's not very intuitive to see just the raw HTML. You can right-click on this output and select to view it in a browser, but it would be a whole lot nicer if there were an HTML rendering engine built into the IDE so that you could see it inline.
Figure 5. Debugging Output. The output would be nicer if there were a preview instead of raw code.
Figure 6. Smart GoTo Source: Fast access to an element's declaration is a surprising bonus feature.
A great feature is the new 'Smart Goto Source' (see Figure 6
). It allows you to go to a declaration of a variable, class, function, or element. If you hover over the element, hold control, and click on the element you are taken straight to its declaration. Anybody who remembers the 'browse database' functionality from old C++ IDEs will know how useful this can be.
However, a problem occurs if the element is declared in another file. If that file isn't loaded into the IDE you can't use Smart GoTo to get it. For example, if you declare the function 'AddIt' in one file, and used an include statement to call that file in your application, then Smart Goto (and code complete) will not recognize the AddIt function. There is a way around this: If you are using include files, you can use SmartGoto to load that file. In other words, if you have a statement include("addit.php"); in your code, you can hover over the file name and CTRL-Click. The IDE will load addit.php and make everything in it available for Smart Goto Source and code completion.