What best practices should be followed when defining file paths in PHP scripts?

When defining file paths in PHP scripts, it is important to use absolute paths instead of relative paths to ensure consistent behavior across different environments. This helps avoid issues related to file inclusion or require functions not being able to find the specified file. Additionally, using predefined constants like `__DIR__` or `__FILE__` can make the code more readable and maintainable.

// Define file path using absolute path
$file_path = '/var/www/html/myproject/data/file.txt';
// Use predefined constants for better readability
$dir_path = __DIR__ . '/data/';