What are the potential security risks associated with using $_GET in PHP?

Using $_GET in PHP can expose your application to security risks such as SQL injection and cross-site scripting attacks. To mitigate these risks, it's important to sanitize and validate any data coming from the $_GET superglobal before using it in your application.

$param = isset($_GET['param']) ? $_GET['param'] : '';
$param = filter_var($param, FILTER_SANITIZE_STRING);
// Use $param safely in your application