PHP: “Hypertext” Processor?

PHP stands for “PHP: Hypertext Preprocessor” which is designed for processing hypertexts (HTML). This can be seen by its dominant usage: running on a web server as a shared module/CGI script and output “text/html” documents. PHP is the primary mean of generating dynamic contents and database operation. Here’s the working principle of LAMP stack:

Client <-HTTP-> [Apache <> PHP <> MySQL] running on top of Linux

However, the ability of PHP makes it like a general-purpose scripting language. For the document type, PHP can output anything the script wants including binary (like dynamically generating an “image/jpeg”), text (“text/plain”), etc. Simply use a header() call before outputting anything and the client will be happy. For the usage, PHP can run on a web server, on the command line, or used to write graphical applications.

The vast amount of built-in functions of PHP allows easy manipulation of data, resulting in clearer codes so it is suitable to write very high level programs like goods management applications which need to interact with databases. Other than these, PHP can even be used to write operating system! EyeOS is an operating system designed to run remotely in a browser and written completely with PHP.

To conclude, PHP is not only a “hypertext” processor, but also a powerful tool to do whatever you want.