O'Reilly logo

Building Forums with vBulletin by Kathy Kingsley-Hughes, Adrian Kingsley-Hughes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Programming Standards

Good programming is clear, unambiguous programming. Let's run through a few tips to help make your code more readable, easier to debug, and easier to make changes to later on.

Braces

For clarity each brace should be placed on its own line in the code:

if ($condition)
{
// code goes here
}

Don't be tempted to condense code like this:

if ($condition)
{ // code goes here }

Indenting

Indent code between braces:

if ($condition)
{
// code goes here
}

Code between braces within braces should have deeper indenting:

if ($condition)
{
if ($condition2)
{
// code goes here
}
// some more code goes here
}

Give Operators Space

All operators (except -- and ++) should have a space either side.

$a = $b + $c;

String Quoting

All strings should be quoted ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required