Stepping

Once you've broken into the debugger, you can step through your code - execute one line at a time. The step commands include Step Into, Step Over, and Step Out.

Step commands

Stepping commands

Step Into will execute the next statement and stop. If the next statement is a call to a function, the debugger will stop at the first line with the statement of the function being called. Check the Debug, Step Into menu to find the keyboard shortcut to use to step (typically F11)

Step commands

Note: In the previous picture, Step into has broken at the first line with the statement. Not at {, as it's usual behaviour in Visual Studio. The reason is PHP doesn't generate any instruction there to break on.

Step Over will execute the next statement, but if it is a call to a function then the entire function will be executed. This allows you to easily skip functions when you are not interested in debugging them. Check the Debug, Step Over menu to find the keyboard shortcut (typically F10).

Step Out will execute until the end of the current function. It is useful when there is nothing else interesting in the current function. Check the Debug, Step Out menu to find the keyboard shortcut (typically Shift+F11).

Known PHP limitation: Stepping out from a function provided as an argument will not break in the calling function, but in the next line with statement instead.

Sample:

PHP specific Step Out

If you want to continue running, press F5. Your program will not break until the next breakpoint. Note that when you Step Over or Step Out, if the running code hits a breakpoint it will break again, even if it has not reached the end of the function.

Stepping when debugging multiple requests(processes)

You can debug multiple requests (processes) at a time. In this case usual stepping is not sufficient, as usual stepping just steps in current process, but runs other processes. What you want is to have other processes in break mode and just step in the current process. You can achive that by these commands:

  • Step Into Current Process (typically Ctrl + Alt + F11)
  • Step Over Current Process (typically Ctrl + Alt + F10)
  • Step Out Current Process (typically Ctrl + Shift + Alt + F11)