Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should there be a space between if and parentheses? [closed]

Tags:

php

Is there there supposed to be a space, between the eg. if and parentheses in statements? Like:

if(something)

or:

if (something)
like image 790
something Avatar asked Oct 07 '11 18:10

something


2 Answers

This kind of whitespace doesn't matter. It's up to personal preferences. Various open-source projects will usually define rules for code formatting, and you might want to if you're working in a team, but if you're working alone, just do whatever you like most.

like image 64
Alex Turpin Avatar answered Oct 14 '22 01:10

Alex Turpin


you can use it either way. But keeping a standard coding style will help you make code that can be easily understood by other programmers.

Some of which are specified here.

http://pear.php.net/manual/en/standards.php

http://codex.wordpress.org/WordPress_Coding_Standards

like image 23
Mithun Satheesh Avatar answered Oct 14 '22 00:10

Mithun Satheesh