Programmer's Reference Guide
| Übersicht |
PHP Dateiformatierung
Allgemein
Für Dateien, welche nur PHP Code beinhalten ist der schliessende Tag ("?>") nicht zugelassen. Er wird von PHP nicht benötigt, und das Weglassen verhindert das versehentlich Leerzeilen in die Antwort eingefügt werden.
Hinweis: Wichtig: Einbeziehen von beliebigen binärischen Daten durch __HALT_COMPILER() ist in den PHP Dateien im Zend Framework oder abgeleiteten Datei verboten. Das Benutzen ist nur für einige Installationsskirpte erlaubt.
Einrücken
Ein Einzug sollte aus 4 Leerzeichen bestehen. Tabulatoren sind nicht erlaubt.
Maximale Zeilenlänge
Die Zielzeilenlänge ist 80 Zeichen. Entwickler sollten jede Zeile Ihres Codes unter 80 Zeichen halten, soweit dies möglich und praktikabel ist. Trotzdem sind längere Zeilen in einigen Fällen erlaubt. Die maximale Länge einer PHP Codezeile beträgt 120 Zeichen.
Zeilenbegrenzung
Die Zeilenbegrenzung folgt der Unix Textdatei Konvention. Zeilen müssen mit einem einzelnen Zeilenvorschubzeichen (LF) enden. Zeilenvorschub Zeicen werden duch eine ordinale 10, oder durch 0x0A (hexadecimal) dargestellt.
Beachte: Benutze nicht den Wagenrücklauf (CR) wie in den Konventionen von Apple's OS (0x0D) oder die Kombination aus Wagenrücklauf und Zeilenvorschub (CRLF) wie im Standard für das Windows OS (0x0D, 0x0A).
| Übersicht |
Add A Comment
Please do not report issues via comments; use the ZF Issue Tracker.
If you have a JIRA/Crowd account, we suggest you login first before commenting.

Comments
Zum Beispiel
<?php
includes
functions
processing
/***HTML OUTPUT****/
?>
<html>
..
<?php echo $header; ?>
<?php buildTable(...); ?>
</html>
232417
a lot of tabs if you ask me
@adam : ++;
Nice april fools Zend so fun !
"Indentation should consist of 4 spaces. Tabs are not allowed." WTF? This, again, makes no sense. This suggests misunderstanding of what certain characters are for. Spaces are *not* for cosmetic formatting of code. Tabs are generally used for indentation - in fact, that is what they were created for. If an editor messes up code indented with tabs, that is a bad editor. Good ones allow the exact setting of tab stops. This is again a very bad approach to solving an otherwise very easy problem.
Maximum Line Length and Line Termination are okay.
Spamming space and delete is stupid and its contributing to RSI!
Honestly, I cannot stress enough how much it annoys me when I see 1 space, then 2 spaces, then 3 spaces, then 2 spaces, then 4. I don't mean to but being a little obsessive I waste a lot of time trying to sort them out for readability.
Ctrl + a, open, find+replace, 4 spaces for a tab :P
"The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using include() or require(), so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace at the end of the parts generated by the included files."
From http://php.net/manual/en/language.basic-syntax.instruction-separation.php