What is PHP?


Tutorial Topic:

PHP: Hypertext Preprocessor is a general-purpose programming language that is specifically developed for web development purposes. This means that it can be used to develop websites with dynamic content and logics.

PHP code may be:

  • executed with a command line interface (CLI)
  • embedded into an HTML code
  • used in combination with various Template Systems, Web Content Management Systems (CMS), and Web Frameworks

PHP code is usually processed by the web server in the background and the resulting output is shown on the front end to the user in any form of data like html code or binary image data.

PHP is a free software released under the PHP License. PHP has been widely ported and can be deployed on most web servers on almost every operating system and platform, free of charge.

Latest PHP Version: PHP 8 (8.1.5)

A new major PHP version was developed in 2017, which was numbered PHP 8. The current latest stable version in this series is PHP 8.1.5.

Syntax & Examples

The basic PHP syntax is:

<?php echo 'Hello World!'; ?>

The opening php tag is <?php and the closing php tag is ?>.

The PHP statement is echo 'Hello World!';. Each PHP statement ends with ;.

The above code shows the text Hello World! to the user.

Basic usage of PHP in an HTML page is given below

<!DOCTYPE html>
  <title>PHP Usage in HTML</title>
  <?php echo 'Hello, World!'; ?>

The above code will show the text Hello World! in an HTML page in a web browser.