PHP is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

It is a server-side scripting language primarily used for web development.

It is widely popular and has a large community of developers contributing to its growth.

PHP is known for its ease of use, flexibility, and powerful features, making it an excellent choice for building dynamic and interactive web applications


  • To run PHP code on your machine, you need a web server. We recommend using either Apache or Nginx. You can choose the one that best suits your needs.
  • Next, you need to install PHP on your system. PHP has official packages for different operating systems, making installation straightforward. You can visit the official PHP website ( ( for detailed instructions.
  • I would recommend using Xampp. It will install apache web server, php, mysql and phpmyadmin.

Where to put code

  • Put your php code between
  • Save php file with .php extension
  • Lets create simple home.php file and print something

<?php echo "Hello World"; ?>


  • A comment is a note written in the code source with the purpose of explaining the code.
  • A multi line comment is written with a slash and asterisk /*, */, as start and finish tags with the comment in between.
  • Comments can also be used to prevent certain code from running, which is known as commenting out the code. This is useful for testing purposes.

	echo 'Hello'; // This is a single-line comment

	// $i = 1;

	/* This is
	a multi-line
	echo 'World';

Why Use PHP

  • PHP is open-source and free, making it cost-effective for web development projects.
  • It has a large and active developer community, offering extensive support and resources.
  • PHP is platform-independent and compatible with various operating systems.
  • It can easily integrate with databases like MySQL, enabling dynamic and data-driven web applications.
  • PHP is known for its flexibility, allowing developers to create both simple websites and complex web applications efficiently.

<!DOCTYPE html>
	<h1> <?php echo 'Header Text'; ?> </h1>
	<?php echo "<p>Para Text</p>"; ?>