What are the potential risks associated with using eval() and include() functions in PHP?

Using eval() and include() functions in PHP can pose security risks as they can execute arbitrary code, making your application vulnerable to code injection attacks. To mitigate these risks, it is recommended to avoid using eval() and to sanitize user input before including files with include().

// Sanitize user input before using include()
$filename = filter_var($_GET['file'], FILTER_SANITIZE_STRING);
include('path/to/directory/' . $filename);