What is PHP?

PHP is a programming language for building dynamic, interactive Web sites. As a general rule, PHP programs run on a Web server, and serve Web pages to visitors on request. One of the key features of PHP is that you can embed PHP code within HTML Web pages, making it very easy for you to create dynamic content quickly.

What exactly does the phrase "dynamic, interactive Web sites" mean? A dynamic Web page is a page whose contents can change automatically each time the page is viewed. Contrast this with a static Web page, such as a simple HTML file, which looks the same each time it's displayed (at least until the page is next edited). Meanwhile, an interactive Web site is a site that responds to input from its visitors. A Web forum is a good example users can post new messages to the forum, which are then displayed on the site for all to see. Another simple example is a contact us form,

Where visitors interact with the page by filling out and sending a form, which is then emailed to the Webmaster.

PHP stands for PHP: Hypertext Preprocessor, which gives you a good idea of its core purpose: to process information and produce hypertext (HTML) as a result. (Developers love recursive acronyms,
and PHP: Hypertext Preprocessor is a good example of one.)

PHP is a server-side scripting language, which means that PHP scripts, or programs, usually run on a Web server. (A good example of a client-side scripting language is JavaScript, which commonly runs within a Web browser.) Furthermore, PHP is an interpreted language a PHP script is processed by the PHP engine each time it run.

The process of running a PHP script on a Web server looks like this:

  • A visitor requests a Web page by clicking a link, or typing the pages URL into the browsers address bar. The visitor might also send data to the Web server at the same time, either using a form embedded in a Web page, or via AJAX (Asynchronous JavaScript And XML).
  • The Web server recognizes that the requested URL is a PHP script, and instructs the PHP engine to process and run the script
  • The script runs, and when its finished it usually sends an HTML page to the Web browser, which the visitor then sees on their screen.