How can the file path be correctly specified in the include() function to ensure that the desired file is included in PHP scripts?

When specifying the file path in the include() function in PHP, it's important to use the correct path relative to the current script location. One way to ensure the desired file is included is to use the magic constant __DIR__ to get the directory of the current script and then concatenate the desired file path to it. This way, the include() function will correctly locate and include the desired file.

include(__DIR__ . '/desired_file.php');