```
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>PHP Cheatsheet</title>
<style>
@page { size: A4 landscape; margin: 0; }
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --php: #777BB4;
  --php-dark: #4F5B93;
  --php-darker: #2C3E66;
  --ink: #1a1a1a;
  --muted: #5a6470;
  --line: #d8dde3;
  --bg-soft: #f5f5fb;
  --code-bg: #1e2a3a;
  --code-fg: #e6e6e6;
  --plus: #2c8a3e;
  --minus: #c0392b;
}

html, body {
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  font-size: 8pt;
  line-height: 1.35;
}

.page {
  width: 297mm;
  height: 210mm;
  padding: 7mm 9mm 18mm 9mm;
  position: relative;
}

/* ===== HERO ===== */
.hero {
  display: table;
  width: 100%;
  border-bottom: 2pt solid var(--ink);
  padding-bottom: 2.5mm;
  margin-bottom: 4mm;
}
.hero-logo, .hero-text, .hero-meta {
  display: table-cell;
  vertical-align: middle;
}
.hero-logo { width: 18mm; padding-right: 4mm; }
.hero-logo-box {
  width: 15mm; height: 15mm;
  background: linear-gradient(135deg, var(--php) 0%, var(--php-dark) 100%);
  border-radius: 4mm;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12pt; font-weight: 800;
}
.hero h1 { font-size: 18pt; font-weight: 800; letter-spacing: -0.5pt; line-height: 1; }
.hero h1 .accent { color: var(--php); }
.hero .sub { font-size: 9pt; color: var(--muted); margin-top: 1mm; }
.hero-meta { width: 35mm; text-align: right; }
.hero-meta .ver {
  display: inline-block;
  background: var(--ink); color: white;
  padding: 1mm 3mm; border-radius: 1.5mm;
  font-size: 9pt; font-weight: 700;
}
.hero-meta .tag {
  display: block; margin-top: 1mm;
  font-size: 7pt; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5pt;
}

/* ===== MAIN GRID: 4 columns ===== */
.main {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 3mm;
}
.col { display: flex; flex-direction: column; gap: 3mm; }

/* ===== BLOCK ===== */
.block {
  background: white;
  border: 0.5pt solid var(--line);
  border-radius: 2mm;
  overflow: hidden;
}
.block-head {
  background: var(--php);
  color: white;
  padding: 1.3mm 2.5mm;
  font-size: 8pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5pt;
  display: flex; align-items: center; gap: 2mm;
}
.block-head .ico { width: 3.5mm; height: 3.5mm; flex-shrink: 0; }
.block-body { padding: 1.8mm 2.5mm; }

/* ===== TABLES ===== */
table { width: 100%; border-collapse: collapse; font-size: 7.5pt; }
td { padding: 0.8mm 1mm; vertical-align: top; border-bottom: 0.3pt solid var(--bg-soft); }
tr:last-child td { border-bottom: none; }
td.k {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 7pt;
  color: var(--php-dark);
  font-weight: 600;
  white-space: nowrap;
  width: 50%;
}
td.v { color: var(--ink); }

/* ===== CODE ===== */
.code {
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: "SF Mono", Consolas, monospace;
  font-size: 6.5pt;
  line-height: 1.4;
  padding: 1.5mm 2mm;
  white-space: pre;
  overflow: hidden;
}
.c { color: #6b8aae; font-style: italic; }
.k { color: #ff79c6; }
.s { color: #f1c40f; }
.f { color: #50fa7b; }
.t { color: #8be9fd; }
.v { color: #ffb86c; }

/* ===== INLINE CODE ===== */
code.inline {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 7pt;
  background: var(--bg-soft);
  padding: 0.3mm 1mm;
  border-radius: 0.8mm;
  color: var(--php-dark);
}

/* ===== KACHEL-GRID ===== */
.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2mm;
}
.tile {
  background: var(--bg-soft);
  border-left: 1.5pt solid var(--php);
  border-radius: 1mm;
  padding: 1.2mm 1.8mm;
  display: flex; align-items: flex-start; gap: 1.5mm;
}
.tile-ico {
  width: 3.5mm; height: 3.5mm; flex-shrink: 0;
  background: var(--php-dark);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-top: 0.2mm;
}
.tile-ico svg { width: 2mm; height: 2mm; }
.tile-text { font-size: 7pt; line-height: 1.25; }
.tile-text b { color: var(--php-dark); display: block; font-size: 7.5pt; }
.tile-text span { color: var(--muted); font-size: 6.3pt; }

/* ===== DIRECTIVES GRID ===== */
.dirgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1mm;
}
.dir {
  background: var(--bg-soft);
  padding: 0.8mm 1.3mm;
  border-radius: 1mm;
  font-size: 6.5pt;
}
.dir b { font-family: "SF Mono", Consolas, monospace; color: var(--php-dark); display: block; font-size: 7.3pt; }
.dir span { color: var(--muted); font-size: 6pt; }

/* ===== SPLIT ===== */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 2mm; }
.split-col h4 {
  font-size: 6.5pt; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4pt; margin-bottom: 0.8mm;
}
.split-col.plus h4 { color: var(--plus); }
.split-col.minus h4 { color: var(--minus); }
.split-col ul { list-style: none; }
.split-col li {
  font-size: 7pt; padding-left: 2.5mm; position: relative;
  margin-bottom: 0.5mm; line-height: 1.25;
}
.split-col.plus li::before { content: "+"; position: absolute; left: 0; color: var(--plus); font-weight: 800; }
.split-col.minus li::before { content: "−"; position: absolute; left: 0; color: var(--minus); font-weight: 800; }

/* ===== FOOTER ===== */
.footer {
  position: absolute;
  left: 9mm;
  right: 9mm;
  bottom: 7mm;
  background: var(--php-darker);
  color: white;
  border-radius: 2mm;
  padding: 2.5mm 4mm;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 4mm;
  align-items: center;
  font-size: 7pt;
}
.foot-item { line-height: 1.3; }
.foot-item b { color: #F1C40F; display: block; font-size: 6.5pt; text-transform: uppercase; letter-spacing: 0.5pt; margin-bottom: 0.5mm; }
.foot-item code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 6.5pt;
  background: rgba(255,255,255,0.15);
  padding: 0.3mm 1mm;
  border-radius: 0.8mm;
}
.foot-tag {
  background: var(--php); color: white;
  padding: 1.5mm 3mm; border-radius: 1.5mm;
  font-weight: 800; font-size: 8pt;
}
</style>
</head>
<body>
<div class="page">

  <!-- HERO -->
  <header class="hero">
    <div class="hero-logo"><div class="hero-logo-box">php</div></div>
    <div class="hero-text">
      <h1><span class="accent">PHP</span> Cheatsheet</h1>
      <div class="sub">Syntax, OOP, Type-System, Standard-Funktionen &amp; Ökosystem auf einen Blick</div>
    </div>
    <div class="hero-meta">
      <span class="ver">8.4</span>
      <span class="tag">Stand 2026</span>
    </div>
  </header>

  <!-- MAIN -->
  <main class="main">

    <!-- SPALTE 1 -->
    <div class="col">

      <section class="block">
        <div class="block-head">
          <svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
            <path d="M3 6h18M3 12h18M3 18h18"/>
          </svg>
          Variablen &amp; Typen
        </div>
        <div class="block-body">
          <table>
            <tr><td class="k">$x = 42</td><td class="v">int</td></tr>
            <tr><td class="k">$x = 3.14</td><td class="v">float</td></tr>
            <tr><td class="k">$x = "Hi"</td><td class="v">string</td></tr>
            <tr><td class="k">$x = true</td><td class="v">bool</td></tr>
            <tr><td class="k">$x = null</td><td class="v">null</td></tr>
            <tr><td class="k">$x = [1,2,3]</td><td class="v">array</td></tr>
            <tr><td class="k">$x = ['k'=&gt;1]</td><td class="v">assoc array</td></tr>
            <tr><td class="k">gettype($x)</td><td class="v">Typ-Name</td></tr>
            <tr><td class="k">is_int($x)</td><td class="v">Typ-Check</td></tr>
            <tr><td class="k">(int)$x</td><td class="v">Cast</td></tr>
          </table>
        </div>
      </section>

      <section class="block">
        <div class="block-head">
          <svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
            <polygon points="13,2 3,14 12,14 11,22 21,10 12,10"/>
          </svg>
          String-Funktionen
        </div>
        <div class="block-body">
          <table>
            <tr><td class="k">strlen($s)</td><td class="v">Länge</td></tr>
            <tr><td class="k">strtolower</td><td class="v">klein</td></tr>
            <tr><td class="k">strtoupper</td><td class="v">groß</td></tr>
            <tr><td class="k">trim($s)</td><td class="v">Whitespace weg</td></tr>
            <tr><td class="k">explode(',', $s)</td><td class="v">→ array</td></tr>
            <tr><td class="k">implode(',', $a)</td><td class="v">→ string</td></tr>
            <tr><td class="k">str_replace</td><td class="v">a → b</td></tr>
            <tr><td class="k">str_contains</td><td class="v">enthält?</td></tr>
            <tr><td class="k">sprintf("%d", 1)</td><td class="v">format</td></tr>
            <tr><td class="k">"$name"</td><td class="v">Interpolation</td></tr>
          </table>
        </div>
      </section>

    </div>

    <!-- SPALTE 2 -->
    <div class="col">

      <section class="block">
        <div class="block-head">
          <svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
            <polyline points="16,18 22,12 16,6"/><polyline points="8,6 2,12 8,18"/>
          </svg>
          Moderne Klasse (PHP 8)
        </div>
        <div class="block-body">
<div class="code"><span class="k">class</span> <span class="t">User</span> {
  <span class="k">public function</span> <span class="f">__construct</span>(
    <span class="k">public readonly</span> <span class="t">string</span> <span class="v">$name</span>,
    <span class="k">public readonly</span> <span class="t">int</span> <span class="v">$age</span>,
    <span class="k">private</span> ?<span class="t">string</span> <span class="v">$email</span> = <span class="k">null</span>,
  ) {}

  <span class="k">public function</span> <span class="f">isAdult</span>(): <span class="t">bool</span> {
    <span class="k">return</span> <span class="v">$this</span>-&gt;age &gt;= <span class="s">18</span>;
  }
}

<span class="v">$u</span> = <span class="k">new</span> <span class="t">User</span>(name: <span class="s">'Marek'</span>, age: <span class="s">34</span>);</div>
        </div>
      </section>

      <section class="block">
        <div class="block-head">
          <svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
            <circle cx="12" cy="12" r="10"/><polyline points="12,6 12,12 16,14"/>
          </svg>
          Array-Funktionen
        </div>
        <div class="block-body">
          <table>
            <tr><td class="k">count($a)</td><td class="v">Anzahl</td></tr>
            <tr><td class="k">array_map(fn, $a)</td><td class="v">transform</td></tr>
            <tr><td class="k">array_filter</td><td class="v">filtern</td></tr>
            <tr><td class="k">array_reduce</td><td class="v">aggregieren</td></tr>
            <tr><td class="k">array_keys</td><td class="v">→ Keys</td></tr>
            <tr><td class="k">array_values</td><td class="v">→ Values</td></tr>
            <tr><td class="k">in_array($x, $a)</td><td class="v">enthält?</td></tr>
            <tr><td class="k">array_merge</td><td class="v">a + b</td></tr>
            <tr><td class="k">sort / usort</td><td class="v">sortieren</td></tr>
            <tr><td class="k">array_unique</td><td class="v">dedupe</td></tr>
          </table>
        </div>
      </section>

    </div>

    <!-- SPALTE 3 -->
    <div class="col">

      <section class="block">
        <div class="block-head">
          <svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
            <path d="M7 17l10-10M17 17H7V7"/>
          </svg>
          Control Flow
        </div>
        <div class="block-body">
<div class="code"><span class="k">if</span> (<span class="v">$x</span> &gt; <span class="s">0</span>) { ... }
<span class="k">elseif</span> (<span class="v">$x</span> &lt; <span class="s">0</span>) { ... }
<span class="k">else</span> { ... }

<span class="k">match</span>(<span class="v">$status</span>) {
  <span class="s">'ok'</span>, <span class="s">'good'</span> =&gt; <span class="s">'positiv'</span>,
  <span class="s">'err'</span> =&gt; <span class="s">'negativ'</span>,
  <span class="k">default</span> =&gt; <span class="s">'?'</span>,
};

<span class="k">foreach</span> (<span class="v">$items</span> <span class="k">as</span> <span class="v">$k</span> =&gt; <span class="v">$v</span>) { ... }
<span class="k">for</span> (<span class="v">$i</span>=<span class="s">0</span>; <span class="v">$i</span>&lt;<span class="s">10</span>; <span class="v">$i</span>++) { ... }
<span class="k">while</span> (<span class="v">$cond</span>) { ... }</div>
        </div>
      </section>

      <section class="block">
        <div class="block-head">
          <svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
            <path d="M22 12h-4l-3 9L9 3l-3 9H2"/>
          </svg>
          Enums &amp; Match
        </div>
        <div class="block-body">
<div class="code"><span class="k">enum</span> <span class="t">Status</span>: <span class="t">string</span> {
  <span class="k">case</span> <span class="t">Draft</span> = <span class="s">'draft'</span>;
  <span class="k">case</span> <span class="t">Published</span> = <span class="s">'published'</span>;
  <span class="k">case</span> <span class="t">Archived</span> = <span class="s">'archived'</span>;

  <span class="k">public function</span> <span class="f">label</span>(): <span class="t">string</span> {
    <span class="k">return match</span>(<span class="v">$this</span>) {
      <span class="t">self</span>::<span class="t">Draft</span> =&gt; <span class="s">'Entwurf'</span>,
      <span class="t">self</span>::<span class="t">Published</span> =&gt; <span class="s">'Veröffentlicht'</span>,
      <span class="t">self</span>::<span class="t">Archived</span> =&gt; <span class="s">'Archiv'</span>,
    };
  }
}</div>
        </div>
      </section>

      <section class="block">
        <div class="block-head">
          <svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
            <circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12" y2="16"/>
          </svg>
          Fehler &amp; Try/Catch
        </div>
        <div class="block-body">
<div class="code"><span class="k">try</span> {
  <span class="v">$result</span> = <span class="f">risky</span>();
} <span class="k">catch</span> (\<span class="t">ValueError</span> <span class="v">$e</span>) {
  <span class="f">log</span>(<span class="v">$e</span>-&gt;getMessage());
} <span class="k">catch</span> (\<span class="t">Exception</span> <span class="v">$e</span>) {
  <span class="k">throw new</span> \<span class="t">AppError</span>(...);
} <span class="k">finally</span> {
  <span class="f">cleanup</span>();
}</div>
        </div>
      </section>

    </div>

    <!-- SPALTE 4 -->
    <div class="col">

      <section class="block">
        <div class="block-head">
          <svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
            <circle cx="12" cy="12" r="3"/><circle cx="12" cy="12" r="9"/>
          </svg>
          Ökosystem
        </div>
        <div class="block-body">
          <div class="tiles">
            <div class="tile">
              <div class="tile-ico"><svg viewBox="0 0 24 24" fill="white"><polygon points="12,2 22,22 2,22"/></svg></div>
              <div class="tile-text"><b>Composer</b><span>Paket-Manager</span></div>
            </div>
            <div class="tile">
              <div class="tile-ico"><svg viewBox="0 0 24 24" fill="white"><circle cx="12" cy="12" r="10"/></svg></div>
              <div class="tile-text"><b>Laravel</b><span>Full-Stack</span></div>
            </div>
            <div class="tile">
              <div class="tile-ico"><svg viewBox="0 0 24 24" fill="white"><rect x="4" y="4" width="16" height="16"/></svg></div>
              <div class="tile-text"><b>Symfony</b><span>Enterprise</span></div>
            </div>
            <div class="tile">
              <div class="tile-ico"><svg viewBox="0 0 24 24" fill="white"><polygon points="12,2 22,22 2,22"/></svg></div>
              <div class="tile-text"><b>PHPUnit</b><span>Tests</span></div>
            </div>
            <div class="tile">
              <div class="tile-ico"><svg viewBox="0 0 24 24" fill="white"><circle cx="12" cy="12" r="10"/></svg></div>
              <div class="tile-text"><b>PHPStan</b><span>Static-Analyse</span></div>
            </div>
            <div class="tile">
              <div class="tile-ico"><svg viewBox="0 0 24 24" fill="white"><rect x="4" y="4" width="16" height="16"/></svg></div>
              <div class="tile-text"><b>Shopware</b><span>E-Commerce</span></div>
            </div>
            <div class="tile">
              <div class="tile-ico"><svg viewBox="0 0 24 24" fill="white"><polygon points="12,2 22,22 2,22"/></svg></div>
              <div class="tile-text"><b>WordPress</b><span>CMS</span></div>
            </div>
            <div class="tile">
              <div class="tile-ico"><svg viewBox="0 0 24 24" fill="white"><circle cx="12" cy="12" r="10"/></svg></div>
              <div class="tile-text"><b>Doctrine</b><span>ORM &amp; DBAL</span></div>
            </div>
          </div>
        </div>
      </section>

      <section class="block">
        <div class="block-head">
          <svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
            <path d="M22 12h-4l-3 9L9 3l-3 9H2"/>
          </svg>
          Idiome vs. Anti-Patterns
        </div>
        <div class="block-body">
          <div class="split">
            <div class="split-col plus">
              <h4>Idiomatisch</h4>
              <ul>
                <li>strict_types=1</li>
                <li>Type-Hints überall</li>
                <li>readonly Properties</li>
                <li>Composer Autoload</li>
                <li>PSR-12 Coding-Style</li>
                <li>match statt switch</li>
              </ul>
            </div>
            <div class="split-col minus">
              <h4>Vermeiden</h4>
              <ul>
                <li>mysql_* Funktionen</li>
                <li>extract() von User</li>
                <li>eval() jeglicher Art</li>
                <li>Globals ($GLOBALS)</li>
                <li>@-Suppression</li>
                <li>include statt require_once</li>
              </ul>
            </div>
          </div>
        </div>
      </section>

    </div>
  </main>

  <!-- FOOTER -->
  <footer class="footer">
    <div class="foot-item">
      <b>Projekt starten</b>
      <code>composer init</code>
    </div>
    <div class="foot-item">
      <b>Server starten</b>
      <code>php -S localhost:8000</code>
    </div>
    <div class="foot-item">
      <b>Tests</b>
      <code>vendor/bin/phpunit</code>
    </div>
    <div class="foot-item">
      <b>Static Analysis</b>
      <code>vendor/bin/phpstan analyse</code>
    </div>
    <div class="foot-tag">php.net</div>
  </footer>

</div>
</body>
</html>
```