User Tools

Site Tools


en:dev:all:psr:psr-2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
en:dev:all:psr:psr-2 [26.05.2015 19:49] – [Methoden- und Funktionsaufrufe] renamed and translated mrbasemanen:dev:all:psr:psr-2 [26.05.2015 20:12] – [foreach] translated mrbaseman
Line 234: Line 234:
 </PHP> </PHP>
  
-===== Kontrollstrukturen ===== +===== Control Structures ===== 
-Für alle Kontrollstrukturen gelten erst einmal folgende, allgemeine Regeln+The general style rules for control structures are as follows
-  * Es MUSS ein Leerzeichen hinter dem Schlüsselwort der Kontrollstruktur sein. +  * There MUST be one space after the control structure keyword 
-  * Es DARF NICHT ein Leerzeichen nach der öffnenden Klammer stehen. +  * There MUST NOT be a space after the opening parenthesis 
-  * Es DARF NICHT ein Leerzeichen vor der schließenden Klammer stehen. +  * There MUST NOT be a space before the closing parenthesis 
-  * Es MUSS ein Leerzeichen zwischen der schließenden Klammer und der öffnenden, geschweiften Klammer stehen. +  * There MUST be one space between the closing parenthesis and the opening brace 
-  * Der Strukturkörper MUSS um eine Stufe eingerückt werden. +  * The structure body MUST be indented once 
-  * Die schließende, geschweifte Klammer MUSS in der Zeile nach dem Kontrollkörper stehen. +  * The closing brace MUST be on the next line after the body 
-Der Körper einer Struktur MUSS in geschweifte Klammern eingeschlossen werdenDiese Standardisierung verhindert Fehlerfalls zufällig Leerzeilen im Körper eingefügt werden. +The body of each structure MUST be enclosed by bracesThis standardizes how the structures lookand 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 ausBeachten Sie die Plazierung von KlammernLeerstellen und geschweiften Klammern. Die Schlüsselwörter **else** und **elseif** MÜSSEN sich mit einer Leerstelle Abstand auf der selben Zeile befinden, wie die schließende, geschweifte Klammer des vorhergehenden Strukturkörpers.+An **if** structure looks like the followingNote the placement of parenthesesspaces, and braces; and that **else** and **elseif** MUST be on the same line as the closing brace from the earlier body separated by one space character.
 <PHP> <PHP>
 if ($expr1) { if ($expr1) {
Line 257: Line 254:
 } }
 </PHP> </PHP>
-Das Schlüsselwort **elseif** SOLLTE anstelle von **else if** so dass alle Schlüsselworte wie einzelne Worte aussehen. +The keyword **elseif** SHOULD be used instead of **else if** so that all control keywords look like single words.
- +
 ==== switch, case ==== ==== switch, case ====
-Eine **switch**-Struktur sieht wie nachfolgend ausBeachten Sie die Plazierung von KlammernLeerstellen und geschweiften Klammern. +**switch** structure looks like the followingNote the placement of parentheses, spacesand bracesThe **case** statement MUST be indented once from **switch**, and the **break** keyword (or other terminating keywordMUST be indented at the same level as the **case** bodyThere MUST be a comment such as %%//%%// no break// when 'fall-throughis intentional in a non-empty **case** body.
-Das **case**-Statement MUSS eine Stufe ab **switch** eingerückt werden und das **break** Schlüsselwort (oder ein anderes, abschließendes SchlüsselwortMUSS auf die selbe Ebene eingerückt werden, wie der **case**-KörperEs MUSS ein Kommentar wie %%//%%// no break//  eingefügt werden, wenn ein 'durchfallenzum nächsten **case** erwünscht ist.+
 <PHP> <PHP>
 switch ($expr) { switch ($expr) {
Line 281: Line 275:
 } }
 </PHP> </PHP>
- 
- 
  
 ==== while, do while ==== ==== while, do while ====
-Ein **while**-Statement sieht wie nachfolgend ausBeachten Sie die Plazierung von KlammernLeerstellen und geschweiften Klammern.+**while** statement looks like the followingNote the placement of parenthesesspaces, and braces.
 <PHP> <PHP>
 while ($expr) { while ($expr) {
Line 291: Line 283:
 } }
 </PHP> </PHP>
-ebenso sieht ein **do while**-Statement wie nachfolgend ausBeachten Sie die Plazierung von KlammernLeerstellen und geschweiften Klammern.+Similarly, a **do while** statement looks like the followingNote the placement of parentheses, spacesand braces.
 <PHP> <PHP>
 do { do {
Line 297: Line 289:
 } while ($expr); } while ($expr);
 </PHP> </PHP>
- 
- 
  
 ==== for ==== ==== for ====
-Ein **for**-Statement sieht wie nachfolgend ausBeachten Sie die Plazierung von KlammernLeerstellen und geschweiften Klammern+**for** statement looks like the followingNote the placement of parenthesesspaces, and braces.
 <PHP> <PHP>
 for ($i = 0; $i < 10; $i++) { for ($i = 0; $i < 10; $i++) {
Line 307: Line 297:
 } }
 </PHP> </PHP>
- 
  
 ==== foreach ==== ==== foreach ====
-Ein **foreach**-Statement sieht wie nachfolgend ausBeachten Sie die Plazierung von KlammernLeerstellen und geschweiften Klammern+**foreach** statement looks like the followingNote the placement of parenthesesspaces, and braces.
 <PHP> <PHP>
 foreach ($iterable as $key => $value) { foreach ($iterable as $key => $value) {
en/dev/all/psr/psr-2.txt · Last modified: 31.03.2017 06:59 by Manuela v.d.Decken