Warning: You're looking at a styleless page because your browser is ignoring CSS styles. You're probably using a very old browser, or you disabled CSS support by purpose. We suggest you to download a modern browser such as Firefox or Internet Explorer.
A breakpoint is essentially a command to the debugger to pause execution of the PHP Script on a certain line. When execution pauses on a line, it pauses just before the line is executed. Breakpoints are only valid on lines which contain PHP statements which can be executed. This excludes empty lines, comments, class declarations, function declarations, method declarations, lines containing only brackets, and lines containing only HTML.
To toggle a breakpoint on the currently selected line, choose Debug>Toggle Breakpoint from the menu (F5). Alternately, a breakpoint may be toggled on any line by clicking in the gutter next to the line.
To disable a breakpoint, right click in the gutter on the breakpoint symbol and choose Disable Breakpoint from the menu. The breakpoint can be enabled by right clicking in the gutter on the breakpoint symbol and choosing Enable Breakpoint
Execution does not always have to pause at a breakpoint. For instance, a user may desire to pause execution only if a local variable is set to a certain value. By using conditions and hit skipping, breakpoints become very flexible debugging tools.
Conditions
:
Conditions are entered into the breakpoint dock. For more information, see the user manual section Debugger: Docks.
A condition can be any valid PHP expression. If the expression evaluates as true, the debugger will increment the hit count. If "Skip hits" is set to zero, execution will pause on that line.
In the following example, the user wishes the debugger to stop execution on line 27 if the variable $numerator is larger than 100, and on line 28 when the variable $denominator is equal to zero. This figure shows how the breakpoints and conditions were set before the debugging session was started.
After the user initiates the debugging session, the debugger evaluates the conditions at the breakpoints. On line 27, $numerator > 100 evaluates to FALSE, so execution continues. On line 28, $denominator == 0 is TRUE, so execution pauses on line 28. The following figure shows the IDE during the debugging session. Lines with valid breakpoints are outlined in red. A blue outline is used top show where execution is currently paused. Note that in the figure it is paused on line 28.
Skipping Hits
:
Each time the condition is met, the debugger increments the Hit Count field. When the hit count is higher than the value in the Skip Hits field, execution pauses. By placing a breakpoint inside a loop, function, or method, and then setting a value in the Skip Hits field, it is possible to pause execution after a certain number of hits has passed. Note: A blank Condition field always increments the Hit Count field.
In the following example, the user wishes the debugger to stop execution on line 45 after the loop has iterated 2 times. This figure shows how the breakpoints and conditions were set before the debugging session was started.
After the user initiates the debugging session, the debugger increments the Hit Count field each time line 45 is reached. When the Hit Count field exceeds the Skip Hits field, execution pauses on line 45. Note in the following figure how the Output dock contains the results of two iterations through the loop.
Combining conditions and skipping
:
By using a combination of skipping and conditions, the user can set up complex and interesting debugging scenarios. In the following example, the user wishes execution to pause only when $i is divisible by five, and only after this condition has been met four times.
After starting the debugging session, execution has paused on line 63. The Hit Count column shows that $i was divisible by five five times so far (at 5,10,15,20,and 25) and the output window reflects that execution has stopped when then condition had been met more than four times.