Answer the question
In order to leave comments, you need to log in
What is the best way to name $itemText or $item_text variables in php?
Actually, the question is already for experienced developers)
It’s just that the situation is such that $item_text is much easier to read, but as I understand it, this is already an outdated form and I don’t even know what to do.
Ps I understand that purely technically there is no difference, but I don’t want to turn my work into shit code because of such a trifle :)
Answer the question
In order to leave comments, you need to log in
1. There are only 2 sources of truth - PSR and Coding Standard of a specific project or team.
2. Specifically, PSR-1 says the following:
4.2. Properties
This guide intentionally avoids any recommendation regarding the use of
$StudlyCaps, $camelCase, or $under_score property names.
Whatever naming convention is used SHOULD be applied consistently within a
reasonable scope. That scope may be vendor-level, package-level, class-level,
or method-level.
In short: no matter what style you use, the main thing is to use the same one. That is, we return to the second option - standard projects / teams.
3. As for "industry standards", most modern projects already use camelCase for properties and methods, PascalCase (StudlyCaps) for files, classes and namespaces.
Govnokod is about something completely different. If the project uses snake_case everywhere and you will use it always and everywhere, this will not affect the quality of the code in any way. Consistency matters.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question