What is the difference between using echo and return in PHP when outputting SVG images?

When outputting SVG images in PHP, it is important to use the correct method for displaying the image data. Using `echo` to output SVG images may result in unexpected behavior or errors, as `echo` is typically used for displaying text content. Instead, it is recommended to use `return` to output the SVG image data, as it will properly handle the binary image data without any interference.

<?php
// Function to output SVG image using return
function outputSVGImage() {
    $svgData = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /></svg>';
    return $svgData;
}

// Output the SVG image
header('Content-Type: image/svg+xml');
echo outputSVGImage();
?>