Web Dev Academy Backend languages · PHP Tool 38 / 64
Backend languages

PHP

The web's workhorse. PHP runs on the server, mixes logic right into HTML, and renders a finished page before it ever reaches the browser.

Demo 01

Browser ↔ PHP server

A request goes out, PHP runs on the server, and plain HTML comes back. Click Request page to watch the round-trip and see the rendered result. This is a simulation — real PHP executes on a server, here it's mimicked in JS.

<!-- profile.php -->
<?php
  $name  = $_GET['name'] ?? 'Guest';
  $hour  = (int)date('G');
  $greet = $hour < 12 ? 'Good morning' : ($hour < 18 ? 'Good afternoon' : 'Good evening');
  $skills = ['PHP', 'MySQL', 'Laravel'];
?>
<h3><?= $greet ?>, <?= htmlspecialchars($name) ?>!</h3>
<p>Server time: <?= date('H:i:s') ?></p>
<ul><?php foreach ($skills as $s): ?><li><?= $s ?></li><?php endforeach; ?></ul>
🌐 Browser 🐘 PHP engine 📄 HTML out 🌐 Browser renders
https://example.com/profile.php?name=Ada
Press “Request page” to load…
Demo 02

Echo, variables & string interpolation

PHP's bread and butter is generating text. Type below and the "engine" runs an echo with double-quoted interpolation — just like the real thing (simulated output).

<?php
  $user  = "Linus";
  $count = 7;
  echo "Welcome back, $user — you have $count new messages.";
?>
// output appears here
Demo 03

Arrays & a foreach loop

Associative arrays are everywhere in PHP. This loop walks a price list and totals it — the simulated engine prints the same rows real PHP would.

<?php
  $cart = ['Coffee' => 3.50, 'Bagel' => 2.20, 'Juice' => 2.80];
  $total = 0;
  foreach ($cart as $item => $price) {
    printf("%-8s €%.2f\n", $item, $price);
    $total += $price;
  }
  echo "Total:   €" . number_format($total, 2);
?>
// output appears here
Demo 04

PHP still runs a huge share of the web

Despite being decades old, PHP powers an enormous slice of websites — largely thanks to WordPress, Laravel and a vast hosting ecosystem.

~74%
of sites with a known server-side language use PHP*
~43%
of all websites run WordPress (built on PHP)*
1995
year PHP was first released — still going strong
8.x
modern PHP: JIT compiler, types, big speed gains

*Widely cited industry survey figures, shown here for context.

Demo 05

$_POST: handling a form

Submitting a form sends data to PHP via $_POST. Fill it in — the simulated handler validates and echoes a response page, exactly like a classic PHP form.

POST → /contact.php
Submit the form to see PHP's response…
i
The code shown is real PHP (<?php ?> tags, echo, foreach, $_GET/$_POST, printf). But PHP runs on a server, not in the browser — so the browser-↔-server round-trip, the rendered pages and every output above are an interactive simulation written in vanilla JavaScript. The shared CSS shell provides the page styling.

↑ All 64 tools