What are the best practices for including files in PHP to ensure smooth functionality and avoid errors?

When including files in PHP, it is important to use the correct file path and ensure that the included file is properly formatted to prevent errors. To ensure smooth functionality and avoid errors, it is recommended to use the `require_once` or `include_once` functions to include files in PHP. These functions will include the file only once to prevent redeclaration errors.

// Include file using require_once
require_once 'path/to/file.php';

// Include file using include_once
include_once 'path/to/file.php';