Are there any potential security risks associated with using functions for value output in PHP?

When using functions for value output in PHP, there is a potential security risk if user input is not properly sanitized before being passed to the function. This can lead to vulnerabilities such as SQL injection or cross-site scripting attacks. To mitigate this risk, always validate and sanitize user input before using it in any function that outputs values.

// Example of sanitizing user input before using it in a function for value output
$userInput = $_POST['input'];
$cleanInput = htmlspecialchars($userInput);

function outputValue($value) {
    echo $value;
}

outputValue($cleanInput);