What are the potential issues with using bindParam() versus bindValue() in PHP PDO?

When using bindParam() in PHP PDO, the parameter is bound by reference, which means that the variable's value is only evaluated at the time of execution, potentially leading to unexpected results if the variable is changed before the query is executed. To avoid this issue, it's recommended to use bindValue() instead, which binds the value of the variable at the time of binding.

// Using bindValue() instead of bindParam() to avoid potential issues
$value = 'example';
$stmt = $pdo->prepare('SELECT * FROM table WHERE column = :value');
$stmt->bindValue(':value', $value, PDO::PARAM_STR);
$stmt->execute();