List or single-line array / parameters: does this or that mode perform better?

A bit of a general question, but he played on my mind for a while.

While learning php coding, to help me create a WordPress theme from scratch, I noticed that some arrays / parameters are stored on one line, while others are listed below one. Personally, I prefer to list arrays under one and the other, as I feel it helps with readability and usually just looks more neat - especially if the array is long.

Does anyone know if there are any “bad effects” of performance in the arrays / parameters list, such as slowing down the page loading speed, etc.? As far as I can see, this is just an encoder preference. Is this the correct assumption?

+4
source share
1 answer

Code formatting does not affect performance.

Even if you claim that a larger file takes longer to read, if you use at least PHP 5.5, then PHP will use the operation cache code - it will cache how it analyzes your files for subsequent requests, excluding any formatting that you have in your file.

+3
source

Source: https://habr.com/ru/post/1668987/


All Articles