When and why would someone use a .inc file extension instead of a .php file extension in PHP?

Using a .inc file extension instead of a .php file extension in PHP is often done for security purposes. By using .inc, it prevents direct access to the file through the web server, which can help protect sensitive information such as database credentials or configuration settings. It is a common practice to use .inc for files that contain functions, classes, or other code snippets that are meant to be included in other PHP files rather than accessed directly.

// Example of including a .inc file in a PHP script
include 'config.inc';