What is the issue with displaying spaces in PHP strings and how can it be resolved?

When displaying spaces in PHP strings, the spaces may not be visible in the output because HTML collapses consecutive whitespace characters into a single space. To resolve this issue, you can use the HTML entity ` ` to represent a non-breaking space in the string.

<?php
$string_with_spaces = "Hello World";
echo $string_with_spaces;
?>