What is the potential issue with using file_get_contents with a variable in PHP?

When using file_get_contents with a variable in PHP, there is a potential security risk if the variable contains user input or untrusted data. This can make your code vulnerable to directory traversal attacks or remote file inclusion. To mitigate this risk, you should sanitize the input before using it in file_get_contents.

// Sanitize the input before using it in file_get_contents
$file = filter_var($_GET['file'], FILTER_SANITIZE_URL);
$data = file_get_contents($file);