Planet For Application Life Development Presents
Technology World

Explore and uptodate your technology skills...

News Navigation: First Previous Next Last

Tips, Tricks and Techniques to be a Good PHP Programmer
09-Jul-2018

Web developers continue to rely on PHP for development. The programming language is used on major sites including Wikipedia and Facebook. Beginners that wish to excel at PHP need to practice coding extensively to learn the language.

Here are tips to that you need to consider before taking your first step into this awesome web development language.

1. Use PHP Core Functions

If you are working on a project that is fairly common, there are chances that you can take advantage of functions or classes that are already available. It is recommended to always check the PHP manual before creating your own functions. For example, you need not remove the white spaces at the begging and end of the string. You can rather use the trim ( ) function. Using native functions will speed-up your development time.

2. Configuration file

Writing the master file that contains settings can save a lot of efforts. It is a better practice to follow than having your database connection settings scattered everywhere. If you need to change these details later, you can make changes to the master file instead of looking for the same thing at several files.

3. Sanitize data that goes into the database

SQL injections are quite common than you may think. You can save a big headache by sanitizing your database inputs. The first thing you can do is learn popular ways that your app can be compromised. Having a good understanding of SQL injections can help in a long run.

4. Keep error reporting turned on

Looking at PHP White Screen of Death is never helpful to anyone. If you get in the habit of leaving error_reporting and display_errors turned on to see run-time errors, it can help you identify where the errors are coming from. The major reason behind this practice is to easily help you find your errors and fix them.

5. Don’t over-comment your code

A proper documentation is essential but you must not over-comment your code. Most beginners develop this habit to comment every single line, but it is not necessary. You can comment the complex part of your source code to revisit it later. Commenting on simple things will increase your coding time and efficiency.