Extension . Class in PHP files

Asked

Viewed 384 times

1

Studying some code on the web I found some files that use .class.php. What is the difference between this type and .php.

  • It is still text file, the name will be.class file with php extension

  • but what’s the difference?

  • 1

    only the in name, you can use to say that the php file has a class, just to leave organized, but does not change anything

1 answer

3


These files have a .class before.

Really, that’s all that’s different, because you can use whatever name you want. There’s nothing that requires it. It’s a convention some people have adopted. What goes inside can be anything, although some people usually put a class inside this file. Nothing prevents you from putting an HTML, text or anything else inside. Your server is probably set to expect PHP code because of the extension .php and will call the PHP interpreter who expects a code that can be executed correctly.

Another tip is that object orientation is more of a conceptual thing than a technical thing. If you don’t master very well, it’s better not to use it at all. In PHP has very little advantage in its use.

  • What knowledge would you recommend me to learn to evolve in the use of PHP?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.