D
D
Daniel2020-05-09 15:28:46
PHP
Daniel, 2020-05-09 15:28:46

Standards for coding html with php?

While studying code design standards, I came across an inconsistency: html is recommended to be indented by 2 spaces, and php by 4 (and indicated "NOT tabulation")
Based on this, a couple of questions:
1. What does "NOT tabulation" mean, if, for example, in Does
VSCode set the number of spaces in a tab? (What is a tab in general then?) Will a tab differ from spaces manually in some way? (Still, is it worth putting spaces manually?) Because of the indentation of 4 spaces (instead of 2, as in html), PHP starts drawing extra vertical lines (see screenshot). php, indents are set to 2 spaces ...

5eb6a305b687f815760459.png

In general, this is such a dilemma.

Am I the only one who cares?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
strelok011, 2020-05-09
@strelok011

As already advised - tab and space character are different characters. IDEs, when you press the tab button, replace the tab character with the number of spaces that is set by default, or! registered in the settings of the current project (in the workspace config for example).
In general, it is correct to use spaces. 2 or 4 - depends on the agreements on the project. If you write for the soul - put it in a way that is clearer. I would prefer 2 because sometimes the line does not fit into the visible part of the screen.
Vertical bars - usually the IDE highlights the levels of nesting of code structures with the ability to collapse them for convenience. Set up once per workspace or globally - you will be happy :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question