.inc files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

.inc files

Post by Skittlewidth »

Quick question: What is the advantage of naming include files "file.inc" or "file.inc.php" over "file.php"? With a simple .inc extension the code can be read in a browser, so I can see the need for the .php, but then why include .inc at all? Is it just so developers can see at a glance which files are their include files?

Just curious :)
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Re: .inc files

Post by JayBird »

Skittlewidth wrote:Quick question: What is the advantage of naming include files "file.inc" or "file.inc.php" over "file.php"? With a simple .inc extension the code can be read in a browser, so I can see the need for the .php, but then why include .inc at all? Is it just so developers can see at a glance which files are their include files?

Just curious :)
Using .inc on its own is bad, unless your server is set to parse them

using just .php is perfectly fine.

using .inc.php as you say, is just for readbality purposes, and to see at a glance, what files do what
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

It's an organisational thing. I have .inc.php, .class.php, .function.php, .image.php .. all sorts of things. I find it useful.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

onion2k wrote:It's an organisational thing. I have .inc.php, .class.php, .function.php, .image.php .. all sorts of things. I find it useful.
That's exactly the way I do things. It also makes searching for files much easier for me too.

.function.php
.class.php
.inc.php
.image.php
.css.php (dynamic css scripts)
.js.php (dynamic js scripts)

yadda yadda yadda :wink:
Post Reply