Editor's note (2026): We've updated this 2014 post. The original code used the
mysql_*functions, which were removed in PHP 7 and are insecure; the example below uses PDO. Several editors in the original list (Dreamweaver for PHP, WebMatrix, Alleycode, phpDesigner) are discontinued or rarely used today. An unsourced statistic has also been removed.
Some simple habits make PHP programming much easier, yet many developers skip them. Here are the essentials.
Use a good editor
A good editor or IDE saves time, highlights errors, and offers code completion. Popular choices today:
- PhpStorm (paid, full IDE)
- Visual Studio Code with PHP extensions (free)
- Notepad++ (free, Windows)
- Sublime Text
- jEdit (free)
Comment wisely
Comment your code; don't count on remembering why you wrote something. But avoid over-commenting. Explain why, not what every line obviously does.
Too much commenting:
$host = 'localhost'; // hostname
$user = 'root'; // username
$pass = 'password'; // password
Better:
// Connect to the database using settings from config.php
$pdo = new PDO($dsn, $dbUser, $dbPass, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
]);
Use shared configuration and layout files
Keep settings such as database connections in one configuration file (for example, config.php, ideally outside the public web folder, or in environment variables). Put the header, navigation, and footer in shared files and load them with require_once. Then you update them in one place instead of on every page. Most open-source PHP software works this way.
Modern PHP projects also use Composer to manage libraries and frameworks like Laravel or Symfony to organize code.
Stay connected with other developers
No one knows everything about PHP. Other developers will show you better and shorter ways to do things. Join forums, communities, and local meetups, and keep an open attitude toward learning.
Plan first, code second
Many developers start coding without a plan. Good developers think through what they're building, sketch the logic or algorithm, and then write the code.
Share your code
Don't be afraid to share code when you're stuck. Posting a small example on a developer forum or getting a code review often solves problems quickly. (Never share passwords, keys, or private data.)
Never give up
Complex applications are challenging. Keep practicing and keep going; persistence is how you improve.
Need experienced help with a PHP application? I.T. For Less can help — contact us.