
|
|
|||
PHP Debugging with Zend StudioBy Michael J. Ross2008-02-03
Breakpoints and Conditions Stepping through each individual line of code is fine if there are few of them, as in our example, or you want to see the effects of most if not all the lines of code. But what if you are only interested in a bit of code in a huge program? That's where breakpoints become indispensable. Imagine that the very first line of display_workers() — where the database handle $db is made global — is where you first want to begin debugging. Click on the line number (in this case, 43) and the entire line is colored pink, indicating that a breakpoint has been set on that line. Then when you run the Go command, the debugger executes all the way up to that line, and stops, regardless of how deep in the code the line is located.
Perhaps you would like the debugger to execute the "for" loop until the loop counter, $i, is equal to 3. In that case, you would first set a breakpoint on that line. Then, set a condition for that breakpoint: In the Debug window's Breakpoints tab, right-click on the breakpoint, select "Edit Condition", and enter "$i = 3" as the watch expression. Then use the Go command to execute up to that point where $i is equal to 3, which is confirmed in the Variables tab in the Debug window.
Tutorial Pages: » Introduction » Overview and Product Editions » System Requirements » Installation and Start Up » User Interface and Preferences » Debugging Basics » Stepping Through the Code » Breakpoints and Conditions » Conclusion |
||||
| About the NetVisits, Inc Network | Write For Us | Advertise Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy. |
Visit other NetVisits, Inc. sites: |