</>
Skip to content
PHP lessons (2/49)

PHP — Introduction

What is PHP?

PHP is a server-side language built for the web. When you log into WordPress, submit a form, or browse Wikipedia, PHP-style code runs on a server, generates HTML, and sends it to your browser.

Key difference from JavaScript: JS usually runs in the visitor's browser; PHP runs on your server, where databases and secrets live.

Hello, world

PHP lives inside HTML, wrapped in <?php ... ?> tags:

<!DOCTYPE html>
<html>
<body>
  <h1><?php echo "Hello, world!"; ?></h1>

  <?php
    $name = "Ada";
    echo "<p>Welcome back, $name.</p>";
  ?>
</body>
</html>

The server executes the PHP, replaces it with output, and the visitor only ever receives plain HTML.

What powers PHP

  • WordPress — around 40% of all websites
  • Wikipedia, Facebook's early days
  • Modern frameworks like Laravel are genuinely pleasant to work with

Variables start with $, statements end with ; — that's half the syntax learned already.

Getting started

Easiest path: install XAMPP (Apache + MySQL + PHP in one), drop files into htdocs, visit localhost.

Related Topics

Frequently Asked Questions about Introduction

What is Introduction in PHP?

Introduction is a fundamental concept in PHP. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Introduction?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Introduction.

Why is Introduction important in PHP?

Introduction is essential for PHP development. Understanding this concept will help you write better code and solve real-world problems more effectively.