What are the potential pitfalls of using variables to display content from language files in PHP?

Using variables to display content from language files in PHP can lead to security vulnerabilities such as code injection if the variables are not properly sanitized. To avoid this, it is recommended to use PHP's `htmlspecialchars()` function to escape any special characters in the content before displaying it on the page.

// Sample code snippet to display content from language files safely
$languageContent = "Hello, <script>alert('XSS attack!')</script>";
echo htmlspecialchars($languageContent);