Skip to content

PHP Tutorial Getting Started with PHP

What Is PHP?

Lesson 1 of 369 2 min read By Deepak Paswan Updated Oct 5, 2026

PHP is a programming language that runs on a web server. When someone opens a page, the server runs your PHP code, and the result is sent to the browser as normal HTML.

Think of a restaurant. The browser is the customer, and the server is the kitchen. The customer never sees how the food is cooked. They only get the finished plate. PHP is the cook in the kitchen.

A first look

This is a complete PHP file. It prints one line of text.

index.php
PHP
<?php
echo "Hello from PHP!";
Output
OUTPUT
Hello from PHP!

The <?php tag tells the server that PHP code starts here. echo prints text. The browser would receive only Hello from PHP!. It never receives the PHP code.

Why PHP exists

Plain HTML is the same for every visitor. Real websites are not. A shop shows your cart, a blog shows the newest posts, and a bank shows your balance. That content changes, so something has to build the page each time. PHP was made for exactly that job.

PHP stands for PHP: Hypertext Preprocessor. The name is a joke inside a name (the first P stands for PHP itself), and you do not need to remember it.

Where you meet PHP

  • WordPress is written in PHP. So are WooCommerce, Drupal and Joomla.
  • Laravel and Symfony are popular PHP frameworks for building applications.
  • Large websites, including Wikipedia (through MediaWiki), run on PHP.

Learning plain PHP first makes all of these easier to understand later.

info
You can run PHP examples on your own computer
The examples in this course show the PHP code and the output you should see. PHP runs on a server, so these blocks have a Copy button instead of a Try it button. Running Your First PHP File shows how to run them yourself in two minutes.

Exercise: say hello

Look at the example above. Which part is PHP code, and which part would the visitor actually see in the browser?

Show the answer

All three lines are PHP code. The visitor sees only the text Hello from PHP!, because the server runs the code and sends back just its output.