spaces inside parenthesis

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.

Related posts

Leave a Reply

1 comment

  1. 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 …