Leaving PHP ending tags in your PHP scripts can cause confusement. For example when you have a blank newline below the PHP ending tag it will sent to the browser. This can cause undesired bugs.
Steps to remove the PHP ending tags in all PHP files
- Select the root folder in the left Project panel
- Press CTRL-SHIFT-R to open the find and replace window
- Enable the checkbox Regex
- Set the File mask to *.php
- In the search input field paste: \?>(\n|)\Z$
- Leave the replace input field empty
Regular expression break down:
Parameter | Description |
---|---|
\?> | Find PHP ending tag |
(\n|) | That has a preceeding newline or not |
\Z | Is at the end of the file |