a non-geek's blog

Random notes on linux and web development

20 tips to become a better PHP Programmer

leave a comment »

If you are a beginner in PHP programming here are 20 tips that will help you to become a better PHP programmer (as suggested by Marc on his post on webgeekly.com):
1) Use <?php and ?>
2) Separate Configuration Files
3) Comment, comment, comment
4) Use Indentation and Spacing (don’t be cheap on whitespaces)
5) Give your Variables Meaningful Names
6) Initialize your Variables
7) Boolean is False, unless True
8) Using Quotes when accessing Array Keys
9) Use commas to echo different strings
10) Use Ternary Operators
11) Use === for Boolean Checks
12) Use ++ and — Operators
13) Use Assignment Operators
14) Create a Variable Dump Function
15) Use Constants
16) Use $_GET and $_POST, avoid $_REQUEST
17) If your function has lots of paramaters use objects instead of functions
18) Use Method Chaining
19) Stop Repeating Code
20) Aim for Loose Coupling, Strong Cohesion

For full post (and explaination) check 20 Tips you need to learn to become a better PHP Programmer

About these ads

Written by nongeekboy

December 16, 2010 at 10:24 am

Posted in php

Tagged with , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 211 other followers

%d bloggers like this: