How to Edit PHP Files

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
A young man in a modern office typing on a laptop computer
Image Credit: nyul/iStock/Getty Images

PHP files contain programming code for dynamic websites, and computers store them as text files without any font or formatting information. You can edit PHP files in any word processor or text editor, but word processors aren't designed to edit programming code. Instead, use a text editor with support for syntax highlighting, automatic indentation and bracket completion to efficiently edit PHP files.

Advertisement

Choose a Text Editor

Video of the Day

In Windows, Notepad++, Crimson Editor and SourceEdit offer all of the features PHP programmers need to edit simple files (links in Resources). For larger projects, you may want to consider an integrated development environment, such as Visual Web Developer or Eclipse (links in Resources). If you only have minor edits to make, you can use Windows Notepad, although it doesn't support syntax highlighting or any other advanced features. Unlike word processors, all these text editors have default settings for coding, so you can begin editing your files right away. Although PHP ignores white space characters, such as Tab and Return, a word processor can add strange line endings that may cause problems at some point. Simply put, programmers don't use word processors because they're the wrong tool for the job.

Advertisement

Video of the Day

Edit PHP Files

After installing a text editor, coding PHP is straightforward. If you're familiar with C++ or Java, the syntax and coding conventions are similar. For a detailed PHP language reference, visit the PHP website to read the documentation (link in Resources). Before editing any files, you may want to set your text editor's preferences. Click "Edit" and choose "Preferences" or a similar option to open the Settings menu, then click each tab to see the available settings. Most text editors support bracket, quote and word completion, and can change the number of spaces in each tab.

Advertisement

Advertisement

Advertisement

references & resources