PHP – filenames

I try to keep with a standard convention when naming files. This will save you time and keep your folders clean. It also makes it easy to come up with filenames for your project. :-)

lowercase
I learned in a web publishing course that it is a good idea to make all your file names in lowercase letters. Why? Some web servers treat TEST.html and test.HTML as completely different files. By using one format consistantly, you remove one level of complexity, and web development is already complex as it is!

Characters, numbers, periods, and underscores
Only use the 26 basic characters, numbers, periods and underscores when naming files.

Use real words
Use real words for your file names for pages. This will help your pages when they are indexed by search engines.

Separate words with underscores
This helps when your web page is scanned by a search engine. Most search engines will separate the words between the underscores and use them as key words. This will help you get a good ranking when those same key words are also in your keywords meta tag and in the body of the page itself.

Always use .php extensions on include files
This prevents anyone from easily downloading and viewing your PHP code in your include file.

PHP class extension: .class.php
Name your PHP classes so the final extension ends with .class.php.

Other PHP includes extenion: .inc.php
Name your other PHP include files with .inc.php.

These basic rules will save you a lot of time in the future. Next PHP page I will talk about how to make an easy to use a global database connection include file.