Book Image

PhpStorm Cookbook

By : Mukund Chaudhary
Book Image

PhpStorm Cookbook

By: Mukund Chaudhary

Overview of this book

Table of Contents (16 chapters)
PhpStorm Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Running to a line of code selected


If you want no breakpoints in your code, but you still want the debugger to break at some point in your code, you are at the correct recipe and reading the correct text. This is also true when the breakpoint you set is already executed or stepped over, but you still suspect another line to be buggy.

How to do it...

  1. To tell PhpStorm to ask the debugger to break at some arbitrary point of your choice, you should exercise the Run to Caret option. As a prerequisite, you have to place the cursor at some line of code in your program. Having done that, you have to now go to Run | Run to Cursor, and PhpStorm will obediently (and politely) ask Xdebug to pause at the location where your cursor has been placed. This is just the same behavior it would have exhibited in the case of a regular breakpoint.

  2. There are three cases to be covered:

    • One is when you have just started debugging your code; the execution will pause on the line you have specified.

    • Another is when you specified...