This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
en:dev:all:psr:psr-2 [26.05.2015 19:53] – [Kontrollstrukturen] renamed and translated mrbaseman | en:dev:all:psr:psr-2 [26.05.2015 20:12] – [foreach] translated mrbaseman | ||
---|---|---|---|
Line 244: | Line 244: | ||
The body of each structure MUST be enclosed by braces. This standardizes how the structures look, and reduces the likelihood of introducing errors as new lines get added to the body. | The body of each structure MUST be enclosed by braces. This standardizes how the structures look, and reduces the likelihood of introducing errors as new lines get added to the body. | ||
==== if, elseif, else ==== | ==== if, elseif, else ==== | ||
- | Eine **if**-Struktur sieht wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. Die Schlüsselwörter | + | An **if** |
<PHP> | <PHP> | ||
if ($expr1) { | if ($expr1) { | ||
Line 254: | Line 254: | ||
} | } | ||
</ | </ | ||
- | Das Schlüsselwort | + | The keyword |
- | + | ||
==== switch, case ==== | ==== switch, case ==== | ||
- | Eine **switch**-Struktur sieht wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | A **switch** |
- | Das **case**-Statement MUSS eine Stufe ab **switch** | + | |
<PHP> | <PHP> | ||
switch ($expr) { | switch ($expr) { | ||
Line 278: | Line 275: | ||
} | } | ||
</ | </ | ||
- | |||
- | |||
==== while, do while ==== | ==== while, do while ==== | ||
- | Ein **while**-Statement sieht wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | A **while** |
<PHP> | <PHP> | ||
while ($expr) { | while ($expr) { | ||
Line 288: | Line 283: | ||
} | } | ||
</ | </ | ||
- | ebenso sieht ein **do while**-Statement wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | Similarly, a **do while** |
<PHP> | <PHP> | ||
do { | do { | ||
Line 294: | Line 289: | ||
} while ($expr); | } while ($expr); | ||
</ | </ | ||
- | |||
- | |||
==== for ==== | ==== for ==== | ||
- | Ein **for**-Statement sieht wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | A **for** |
<PHP> | <PHP> | ||
for ($i = 0; $i < 10; $i++) { | for ($i = 0; $i < 10; $i++) { | ||
Line 304: | Line 297: | ||
} | } | ||
</ | </ | ||
- | |||
==== foreach ==== | ==== foreach ==== | ||
- | Ein **foreach**-Statement sieht wie nachfolgend aus. Beachten Sie die Plazierung von Klammern, Leerstellen und geschweiften Klammern. | + | A **foreach** |
<PHP> | <PHP> | ||
foreach ($iterable as $key => $value) { | foreach ($iterable as $key => $value) { |