PHP BasicsCore· 30 min read

What is PHP?

A server-side language that builds web pages dynamically — behind WordPress, Facebook’s early days, and the Laravel framework.

What you will learn

  • Explain what PHP is and where it runs
  • Understand server-side vs client-side
  • See how PHP builds a page

A server-side language

PHP (PHP: Hypertext Preprocessor) is a server-side language. It runs on the server, builds an HTML page, and sends that finished HTML to the browser. The visitor never sees the PHP — only the result.

It powers a massive part of the web — WordPress, Wikipedia, and the Laravel framework you will learn next are all PHP.

PHP (server-side)JavaScript (client-side)
Runs onThe serverThe browser
Can accessDatabases, files, secretsThe page (DOM), the user
Visitor seesOnly the HTML outputThe actual JS code
PHP mixes into HTML
<!DOCTYPE html>
<html>
<body>
  <h1>Welcome</h1>
  <?php
    echo "<p>This paragraph was built by PHP on the server.</p>";
  ?>
</body>
</html>

Note: The browser receives only: <h1>Welcome</h1><p>This paragraph was built by PHP on the server.</p> — the PHP ran and disappeared, leaving HTML.

Tip: Because PHP runs on the server with access to databases, it is perfect for logins, dynamic content and data-driven sites — exactly what Laravel makes easy.

Q. Where does PHP code run?

Answer: PHP runs on the server, builds HTML, and sends only that HTML to the browser. The PHP itself is never sent to the visitor.

✍️ Practice

  1. List three popular websites or tools built with PHP.
  2. In your own words, explain server-side vs client-side.

🏠 Homework

  1. Write two sentences on why server-side code can safely access a database but client-side code should not be trusted with secrets.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →