coding standards - spaces inside parenthesis

admin2025-04-19  0

The Wordpress coding standards states to put spaces both inside and outside opening and closing parenthesis.

What is the rationale behind spaces on the inside of parenthesis? I've hardly ever seen that in any other code except PHP.

The Wordpress coding standards states to put spaces both inside and outside opening and closing parenthesis.

What is the rationale behind spaces on the inside of parenthesis? I've hardly ever seen that in any other code except PHP.

Share Improve this question edited Nov 14, 2019 at 19:40 AFOC 1133 bronze badges asked Apr 13, 2013 at 14:07 ivviivvi 6694 gold badges10 silver badges22 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 5

This is mostly just for readability. The semantics change before and after a parenthesis, and we are used to read spaces as word separators in western languages, so we can read such code faster.

Another point is search: If you want to search for all changes on variables beginning with $post it is easier to write a regex when you know there is always a space before and after. Doesn’t make a big difference, but still …

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745003376a279366.html

最新回复(0)