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.
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>
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."; ?>
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); ?>
Despite being decades old, PHP powers an enormous slice of websites — largely thanks to WordPress, Laravel and a vast hosting ecosystem.
*Widely cited industry survey figures, shown here for context.
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.
<?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.