lusketeer
lusketeer

Reputation: 1930

.class extension for php

I have been digging in the drupal installation folder and found some .inc file. So they stand for 'include', but I'm wondering if there are .class extension for PHP made to distinguish that the file is a class?

Upvotes: 0

Views: 236

Answers (1)

user149341
user149341

Reputation:

The .class extension is typically used for Java classfiles. While there's no technical reason why you can't use it for your PHP include files, doing so will be confusing to other developers, as it may associate the files with a Java virtual machine, rather than with a text editor. It may additionally open you to some security issues: .class files, as well as .inc files, will be made available for download if they are directly accessible from your web root. Both from a security perspective and for the benefit of other developers, you're best off using the .php extension for all PHP files.

Upvotes: 3

Related Questions