Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Include Page
Social Buttons PhpStorm
Social Buttons PhpStorm


Debugging typically consists of pausing the execution of our application at a specific line of code. Such a line of code is called a breakpoint (more about breakpoints later in this tutorial). Breakpoints can be set from the editor window, by clicking in the left-hand gutter. A breakpoint will have a red dot next to it.



Execution halted on line 16. Even though it initializes a variable named $hundred, that variable is nowhere to be seen. Remember what a breakpoint is? Exactly: the line of code in blue is yet to be executed, and thus in this case we have not yet assigned $hundred. Try pressing F8 (Step Over, see #Stepping through Source Code) once and see the line of code is executed and the variable is now assigned.


To view details of a single breakpoint, we can right-click it. This will show us some basic details about the breakpoint and also allows making it a conditional breakpoint.

The Run | View Breakpoints... menu (or Ctrl+Shift+F8 / CMD-Shift-F8) lets us view, edit and add breakpoints for PHP and JavaScript code. It shows options for all breakpoints we have created in our current project.



Why enable/disable breakpoints? Isn't this the same as adding/removing a breakpoint? Well, yes and no. Yes, in that disabling a breakpoint has the same effect as removing the breakpoint: it makes PhpStorm not pause script execution at the specific position. However, we can still see the breakpoint and re-enable it if needed. No need to search that specific location and add a breakpoint if it's needed again: simply enable it from the view breakpoints window.

Breaking when a Condition is True - Conditional Breakpoints