Enabling and Creating Watches in PHP Code

See Also

A watch enables you to track the changes in the value of a variable or expression during program execution. The Watches window lists all of the watches you defined for all IDE projects, of all programming languages. You can open the Watches window by choosing Window > Debugging > Watches (Alt-Shift-2).

Enabling Watches for PHP

Before you can set watches in PHP code, you must enable PHP watches. To enable watches:

  1. Open Tools > Options (NetBeans Preferences on Mac).
  2. Click the PHP icon.
  3. Open the Debugging tab.
  4. Tick Watches and Balloon Evaluation.
  5. Optionally, change the Maximum Depth of Structures and/or the Maximum Number of Children. These numbers set the visibility of nested structures and array items, respectively, during Watch evaluation.
  6. Click OK.

For more information about PHP Debugging Options, click Help at the bottom of the Debugging tab.

Creating Watches in PHP Code

If watches and balloon evaluation is enabled in PHP Options, you can create watches in the Source Editor. To create a watch from the Source Editor:

  1. Select the variable or expression in the Source Editor, right-click, and choose New Watch (Ctrl-Shift-F7).

    The New Watch dialog box opens with the variable or expression entered in the text field.

  2. Click OK.

    The Watches window opens with the new watch selected.

For more details, see the following document.

See Also
Viewing Variables When Debugging PHP Applications

Legal Notices