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

Changing code on the fly


According to no survey, it has been established that most of the bugs in programming arise due to uncertainty in the type and value of data. The real utility of a debugger is apparent when you have the freedom to interfere with the data that is generated during the execution. Thus, you can actually change the value of variables that the interpreter has covered while you are fighting against bugs in your code.

This can be particularly useful in cases where you have to set the width of a text container, and you cannot be sure about the maximum width of the text container.

How to do it...

  1. The Debug view is your friend in this scenario. Focus on the Variables frame.

  2. To assign a value to a variable, select it from the list of variables available.

  3. Access the right-click context menu. Select the Set Value option, and in the textbox that appears, provide some value. You are done immediately after pressing the return key.

  4. From now onwards, wherever this variable is accessed, it...