Saturday, 2 January 2016

Whitespace and Line Breaks

Whitespace and Line Breaks:
 In general, whitespace doesn’t matter in a PHP program. 
You can spread a state- ment across any number of lines, or lump a bunch of statements together on a single line.
For example, this statement:
raise_prices($inventory, $inflation, $cost_of_living, $greed); 
could just as well be written with more whitespace:
raise_prices (                $inventory           ,                $inflation           ,                $cost_of_living      ,                $greed ) ; 
or with less whitespace:
raise_prices($inventory,$inflation,$cost_of_living,$greed);
You can take advantage of this flexible formatting to make your code more read- able (by lining up assignments, indenting, etc.). 
Some lazy programmers take advan- tage of this free-form formatting and create completely unreadable code this isn’t recommended.

No comments:

Post a Comment