How can one avoid syntax errors when using backslashes in file paths within variables in PHP?

When using backslashes in file paths within variables in PHP, it's important to escape the backslashes to avoid syntax errors. This can be done by using double backslashes or by using the PHP built-in function `addslashes()` to escape the backslashes in the file path.

// Example of using double backslashes to escape backslashes in file path within a variable
$filePath = "C:\\xampp\\htdocs\\example\\file.txt";

// Example of using addslashes() function to escape backslashes in file path within a variable
$filePath = "C:\xampp\htdocs\example\file.txt";
$escapedFilePath = addslashes($filePath);