Ders Notu
Çalıştırma
php -S localhost:8000
Sonra http://localhost:8000 adresini aç. PHP dosyasını file:// ile açma.
Hedef görünüm

Gerçek tarayıcı çıktısı: PHP tarafından üretilen etkinlik kartları ve durum mesajları.
Browser → HTTP Request → PHP Server
↓
PHP çalışır
↓
Browser ← HTTP Response ← HTML üretilir
Browser PHP kaynak kodunu çalıştırmaz veya normal response içinde görmez.
Hızlı Syntax
<?php
$title = 'Etkinlikler';
$isOpen = true;
function formatPrice($price) {
return $price . ' TL';
}
$event = [
'name' => 'PHP Atölyesi',
'price' => 0,
];
?>
<h1><?= $title ?></h1>
<?php foreach ($events as $event): ?>
<h2><?= $event['name'] ?></h2>
<?php endforeach; ?>
Debug
var_dump($event);
print_r($events);
Development sırasında hata mesajındaki dosya ve satırı oku. Bu araçları kullanıcıya gösterilecek final UI olarak bırakma.
PHP syntax hedef değil; request'i server'da işleyip response üretmek hedeftir.