Talk:PHP Programming/Coding Standards

Praise
Nicely place, Thanks!. Incredible a good deal of beneficial knowledge.

Contradiction in terms?
In sub section Indenting and Line Length: "Use an indent of one tab" and "set indent-tabs-mode to nil" seems to be a contradiction in terms. --Mortense (discuss • contribs) 16:48, 13 February 2016 (UTC)

Dispute about template system
I agree on most standards mentioned in this article, but doubt if the following one is always the best practice:


 * No "template system" such as Smarty will be used. PHP itself is a templating language.


 * According to revision history of this page, this line was added before 2009. Seven years later we have better template engines and different problems to solve.
 * The discussion on Stackoverflow shows fierce controversy on this topic.

Therefore I'd suggest removing this paragraph.

--Htfy96 (discuss • contribs) 04:22, 20 July 2016 (UTC)
 * Personally I would rather keep it and specify for which PHP versions it's advised. Because there are a certain number of servers which are not updated thanks to (or because of) due diligence. JackPotte (discuss • contribs) 21:22, 20 July 2016 (UTC)
 * What do you mean by "which PHP versions it's advised" here? --Htfy96 (discuss • contribs) 06:19, 21 July 2016 (UTC)

Follow PSR-1 and PSR-2's suggestions

 * PSR-1: Basic Coding Standard
 * PSR-2: Coding Style Guide

Things need to change: --Htfy96 (discuss • contribs) 06:39, 21 July 2016 (UTC)
 * "Method name MUST be declared in 'camelCase'" instead of "c_style" mentioned in this article
 * File format: "PHP code MUST use only UTF-8 without BOM." rather than "Use ISO-8859-1 character encoding"
 * Indenting: "Code MUST use 4 spaces for indenting, not tabs." instead of "Use an indent of one tab"
 * OK for the two first points but in the third we should advise to set one's text editor tab to four spaces, instead of implying to press frantically the keyboard at each new line ;) JackPotte (discuss • contribs) 11:06, 21 July 2016 (UTC)

PHP comments
Why does the text say: C style comments and standard C++ comments  are both fine. The use of Perl / shell style comments is strongly discouraged. ?   for MediaWiki exclusively uses   for comments. Why is this strongly discouraged despite apparently being a common practice? Nicole Sharp (discuss • contribs) 17:48, 14 April 2022 (UTC)