When you start with PHP it is important to understand that your code must not only be correct from computers point of view, but it also should be readable for other programmers, to make it easier some good people worked out some rules, which you should follow when you write your code.
There exists few styles of placement of braces( {} ) and they are dictated by C-like languages of programming.1)Rational style
One of the most used styles cuz it was used by creators of C Kernighan and Ritchie.
It is also used by Java programmers a lot.
+ It saves vertical space, which may be very important especially when your code is big.
- Sometimes it is hard to locate } somewhere in the end of a row...
2)Allman's style
Eric Allman is the man who wrote BSD utilities in that style, so this style is sometimes called "BSD style".
+ The area of block operator is easily visually associated with controlling operator.
3)Whitesmith style
+brackets are more easily associated with code.
4) GNU style
This style was introduced to me in Simple PHP ebook and i am using this style even today.
It was developed by Free Software Foundation fond.
It was developed by Free Software Foundation fond.
Within controlling constructions operators should be placed with equal number of spaces.
Note:indetation must be wether 2, 4 or 8 spaces.
Note:indetation must be wether 2, 4 or 8 spaces.