Best PHP Coding Tips or Standard
Posted on January,27,2010 by Admin
PHP is the need of today’s global market. It needs hardcore programming, there are no drag and drop platforms available like in .net so it’s a bit difficult but yet the best language to work on. Good thing is that it’s very easy to understand if you don’t have any programming experience. Working in PHP is becoming common today as it is replacing other languages at a rapid speed.
Some tips for PHP to ease the programming:
1) Name: Only a good programmer having god knowledge can give the name that fits within the system. By giving appropriate name relationships are clear, meaning is derivable and reasoning works as expected.
2) Class Names: Class name should be named after what it is.
3) Methods and Function Names: Name should make clear what it does to distinguish between functions and data objects. Suffixes are sometimes important like (Max - to mean the maximum value something can have. Key - key value). Example: RetryMax to mean the maximum number of retries, RetryCnt to mean the current retry count.
4) Don’t Use All Upper Class Abbreviations: Example: Do use: GetHtmlStatistic. Do not use: GetHTMLStatistic.
5) Class Names: First name should be in Capital. Example: Class NameOneTwo
6) Class Library Names: When not using name spaces, it's common to prevent class name clashes by prefixing class names with a unique string. Two characters are sufficient, but a longer length is fine. Example: class JjLinkList { }
7) Method Names: Same as class names. class NameOneTwo { function DoIt() {}; function HandleError() {}; }
8) Method Arguments Name: 1st letter should be in lower case, after that all words should be in upper case.
Example: class NameOneTwo
{
function StartYourEngines(&$someEngine, &$anotherEngine) {
$this->mSomeEngine = $someEngine;
$this->mAnotherEngine = $anotherEngine;
}
var $mSomeEngine;
var $mAnotherEngine;
}
9) Variable Names: All letters in lower case, use –as word separator. By this scope of variable becomes clear and different.
10) Array Element: Use _as word separator, - can generate warning.
Example: $myarr['foo_bar'] = 'Hello';
print "$myarr[foo_bar] world"; // will output: Hello world
$myarr['foo-bar'] = 'Hello';
print "$myarr[foo-bar] world"; // warning message
Mtoag works on all the above important points and gives the best results. Mtoag have expert programmers having experience of 5 years in programming, and are enriched with vast knowledge database. This company provides you the best deal in every aspect. You will experience a new thing in life after working with Mtoag. No doubt that this company is a better option for web designing and development, they care for you and value for your time.
Blog Listing
- Website Design Beyond the design aspect
- Best software outsourcing tips
- Best PHP Coding Tips or Standard
- The fastest way To built a Website
- How Are Animations Edit To a Website
- Web Page Design: Ten Mistakes To Avoid
- 5 Simple Tips To on Search Engines
- Add video to Website
- Building A website-Three Basic Rules
- 3 Ways To Boost SEO









