PHP Code Tags :

1. Start PHP file with a <?php tag and end it with the closing ?>.
2. Always use <?php  ?> to delimit PHP code, not the <? ?> shorthand.
3. This is required for PHP compliance and is also the most portable way to include PHP code on different operating systems and setups.

Line Length:

1. Use an indent of 4 spaces and don’t use any tab because different computers use different settings for tab. It is recommended to keep lines at approximately 75-85 characters long for better code readability.

Control Structures:

1. These include if, for, while, switch, etc. Control statements should have one space between the control keyword and opening parenthesis, to distinguish them from function calls. You are strongly encouraged to always use curly braces even in situations where they are technically optional.

Example:

if ((condition1) || (condition2)) {
action1;
} elseif ((condition3) && (condition4)) {
action2;
} else {
default action;
}
Example:
switch (condition) {
case 1:
action1;
break;
case 2:
action2;
break;
default:
defaultaction;
break;
}

Comments:

1. Php contains both single line and multiple line comments, So if you start any class or function definitely mention comments. Comments are most important in every programming language.

Example :

/**
* Class  : <class name>
* Site name :<site name>
* Developing for <page name>
* Company :  <company name>
* @author  <author mail/uname>
* @copyright 2012-2013 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @link  <url>
* PHP version 5
*/
Class <classname> {  //after class name give one space before left curly bracket
}

Example :

/**
* <function functionality>
*
* @param  <mention params>
* @return  <mention return type>
*
Function  <function name> {
}

2. Any where you can mention “=” give one space before equal and after equal
Example:

<?php
$marks = 100;
?>

1. Function names and variable names must follow unique style
i.  camelCase
ii. under_scores