How do you edit .PHP files

I tried to edit a .php file in “Writer” and it ran the code. How do you edit these files?

R

This is not a question related to LibreOffice and especially it is a bad idea at all to use a word processor editing source code.

It is recommended to use a plain “text editor”, like Notepad or Notepad++. These won’t run the PHP script and will save it as you have written it, without adding any word processor formatting.

If you really want to edit a PHP file in Writer (and yes, it is an utterly bad idea), change the file name extension to .txt and open/save it as unformatted text. When you open the file, always set the text language to none, this will (very slightly) reduce your chance of shooting your leg.

for that kind of file try to use a simple text editor (Notpade++ on windows and gedit , kate on linux) or an IDE (integrated development Environment ) such as PHPStorm etc… which can help you to code and make changes easily