Notepad++ Edit syntax highlighting for PHP?

2020-07-02 10:24发布

问题:

I'd like to edit the syntax highlighting for PHP in Notepad++:

  1. To have variables starting with $_ in a different color than variables starting with only $
  2. To have operators like {} () [] in different colors than operators like & =

Is it possible to change the highlighting to be this in-depth? How?

回答1:

This is Possible

In Notepad++, define a new language by clicking View > User-Defined Dialogue...

Give the language a name (e.g. myPHP). Set the ext (file extension abbreviation) to php. Define the color coding for the global variables and for the brackets, braces and parentheses, etc. Close the Dialoague.

That is all. The formatting for myPHP which conflicts with the formatting for PHP will override the formatting for PHP, i.e. if the file has a .php extension.

More information: Notepad++ Wiki



回答2:

To edit the syntax highlighting in Notepad++, follow these steps:

  • Go to Settings, then Style. The configurator dialog opens.
  • Select language php
  • Select the style based on your criteria
  • Save


标签: php notepad++