a non-geek's blog

Random notes on linux and web development

Posts Tagged ‘php tips

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

Written by nongeekboy

December 16, 2010 at 10:24 am

Posted in php

Tagged with , , ,

Follow

Get every new post delivered to your Inbox.

Join 208 other followers