Are there any cross-browser compatibility issues to consider when using PHP to include SVG code inline?

When including SVG code inline using PHP, one potential cross-browser compatibility issue to consider is how different browsers handle the rendering of SVG elements. To ensure consistent rendering across browsers, it is important to properly encode the SVG code before including it inline. This can be achieved by using the htmlspecialchars() function in PHP to escape special characters in the SVG code.

<?php
$svgCode = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><circle cx="50" cy="50" r="40" fill="red" /></svg>';

$encodedSvg = htmlspecialchars($svgCode);

echo '<div>' . $encodedSvg . '</div>';
?>