Syntax Coloring

PDT can automatically apply different colors and font attributes to different PHP syntax elements in order for your scripts to be more easily navigable and to help you find relevant sections quickly and easily. With the Syntax Coloring Rules you can set the foreground color, background color and font type for a range of different elements in your code through the Syntax Coloring Preferences page. This allows for a quick assessment of your code with the different elements individually visible, making errors visually distinct and easier to detect.

Completing the relevant element will cause the required color and font settings to be applied to it.

syntax_coloring_example.png

 

The table below goes into further detail about the elements available for Syntax Coloring rules and their default settings.

Element Name Element Description Default Foreground Color Default Font
Classes A user defined type (class or interface). classes.png  
Constants A variable with a value that cannot be altered during execution. constants.png Italic
Deprecated members An unused member which still appears while transitioning to new members. deprecated_members.png Strikethrough
Fields A reference to a class variable fields.png  
Functions A reference to a function functions.png  
Heredoc A Heredoc block representation of a string value. heredoc.png  
Internal classes A Type that was declared by PHP. internal_classes.png  
Internal constants A constant that was declared by PHP. internal_constants.png Bold and Italic
Internal functions A function that was declared by PHP. internal_functions.png  
Keyword A keyword that was declared by PHP. keyword.png Bold
Methods A reference to a method methods.png  
Multi-line comment A comment that spans more than one line. ("* */") multi_line_comment.png  
Normal Any section that does not have any specific description that applies to it. normal.png  
Number A number. number.png  
Parameter variables A variable used in a method which refers to arguments in the method. parameter_variables.png Underline
PHP tags The PHP start and end tag (<?php, ?>). php_tags.png  
PHPDoc A standard for commenting PHP which allows you to insert annotations in your code. phpdoc.png Bold
PHPDoc comment A readable annotation inserted into your code. phpdoc_comment.png  
Single-line comment A comment that spans a single line. single_line_comment.png  
Static fields A reference to a static field static_fields.png Italic
Static methods A reference to a static method static_methods.png Italic
String A sequence of characters selected from a set, which represent a string of data values.   string.png  
Superglobal variables A reference to Superglobal variables such as $_GLOBALS superglobal_variables.png Bold
Task tag A reference to reminders of actions, work to do, or any other action required. task_tag.png Bold
Variable A reference to a variable. variable.png  

Note:

All elements have a default Background of white.

The color and font settings can be configured from the Syntax Coloring preferences page, accessed from Window | Preferences | PHP | Editor | Syntax Coloring.

Note:

Syntax Coloring will also be available for JavaScript elements if JavaScript support was enabled for the project. See Enabling JavaScript Support in PHP Projects for more information.
To configure JavaScript Syntax Coloring preferences, go to Window | Preferences | JavaScript | Editor | Syntax Coloring.

 

 

link_icon.png

Related Links:

Syntax Coloring preferences