PHP Application Development-Something You Can Do To Become a Better PHP Developer
|
More than 20 million websites use PHP including eminent websites like Wikipedia and Facebook are built in PHP. This indicates the popularity of PHP as a language. The biggest opensource projects of the world WordPress and Drupal are belong to PHP. So naturally the numbers of PHP developers are greater than any other languages. In this article I would like to share some good habits to become a better developer than others.
Use PHP Core Functions and Classes
There are plenty of PHP core functions and classes available in PHP manual which can ease your work at greater extent. Chances are more when you want to do something that is common. Always checkout PHP manual before creating your own functions.
Create a Configuration File
It is better you have one master file for your database rather than many scatter files in your project this will allow you to edit, add or delete data whenever you need to. This is also useful when you need to use other constants and functions throughout multiple scripts. Using one configuration file is more popular pattern that makes code more modular and easy to maintain.
Sanitize Data before it Goes into Database
SQL injections are more common phenomenon than you may think. If you want to avoid it totally there is a prerequisite condition and that is sanitization of your database so you never encounter any problem later on. mysql_real_escape_string will take a regular string and sanitize it for you. If you use function together with htmlspecialchars, which converts reserved HTML characters, not only your database be protected, but also safe-guard your apps against cross-site scripting attacks when rendering user-submitted HTML.
Turned on Error Reporting During Development Stage
During development, leave error_reporting and display_errors turned on so you can know where errors come from. You can set up these run-time configurations in your server’s php.ini file.
Avoid Over Comment your Code
Using the comments is a good practice but try to limit the comments and avoid unnecessary comments in your code. Remember good code is self-explanatory most of the time.
Keep Favorite Code Snippets Handy
Repeated coding is common thing in your career and keeping your code snippet handy is good habit. It will save your time and effort. Some apps you can use to corral your code snippets are Snippet, snippely, Code Collector, and Snipplr. Eclipse and Dreamweaver have built in features for storing code snippets. Even you can use Dropbox for this purpose.
|
|
Author Resource:-
Shoaib Marfatiya is working with an eminent and professional PHP Application Development company named Peerbits. Peerbits offers services for PHP application development. At present Shoaib is exploring various topics on PHP Application development and would love to hear from you. If you are interested in PHP Application development and seek further assistance contact us.
|
By :
salman peerbits
Submitted
2012-02-22 15:54:15 |
Article From Article Mayhem
Ezine ready view |
|
|
|
Related Articles
|
|
|