How can the use of the constant DIRECTORY_SEPARATOR improve file inclusion in PHP?

When including files in PHP, using the DIRECTORY_SEPARATOR constant ensures that the correct directory separator is used regardless of the operating system. This helps in making the code more portable and avoids issues related to different directory separator conventions between Windows (\) and Unix-like (/) systems.

<?php
// Define the directory separator constant
define('DS', DIRECTORY_SEPARATOR);

// Include a file using the DIRECTORY_SEPARATOR constant
include 'path' . DS . 'to' . DS . 'file.php';
?>