Using Notepad or TextEdit for PHP

How to Create and Save PHP in Windows and macOS

A screenshot PHP code. Getty Images/Scott-Cartwright

Updated on January 29, 2022

You don’cakrawala need any fancy programs to work with the PHP programming language. PHP code is written in plain text. All Windows computers including those running Windows 10 come with a programa called Notepad that creates and modifies plain-text documents.

Saving PHP Documents

In your text editor, just save the PHP source code with a PHP extension. Windows may or may not recognize PHP as a bonafide system file type, but it doesn’t matter. You generally don’t want Windows to attempt to
a PHP script. You could, however, associate PHP as a file type that your favorite text pengedit manages, so double-clicking a PHP file will open it in that editor.

Media Files Saved as PHP

Some browser plugins that download media from web pages will incorrectly capture the media file’s correct extension. The file will save with the correct name, but with a PHP extension. This glitch occurs only occasionally and stems from the ki alat file sourcing from a PHP-enabled page. All you need to do is change the PHP extension to something like MP4. Video-playback programs like VLC accept the MP4 extension without complaining, even if the underlying video type is something else.

Writing PHP

Unlike some programming and scripting languages, PHP is not sensitive to indentations. Therefore, any indentations you make to your PHP code to aid your readibility are fine.

Other Programs to Edit PHP Files

Notepad is simple, but it’s not the only choice. Mac users can use TextEdit. Hardcore programmers (usually, on Linux) rely on environments like Emacs or Vim.

Better than using a text penyunting — which, by design, just edits text, without additional functionality — is to use a text editor optimized for coding. On the Windows platform, programs like Optis Padepokan Code, BB Edit, UltraEdit, and Notepad++ titinada only edit your text but can
(analyze for errors) and format your code with special colors and related visual cues.