HEREDOC is not a function, it is a method for specifying line separators that allows you to refuse quotes in heredoc (I like it because good text editors will syntactically highlight their contents based on the name heredoc).
HEREDOCs retain all spaces, newlines, etc. I think you are probably looking at the results in a browser. Browsers usually trim all spaces, newlines, spaces and tabs, down to one place. Try looking at it from the command line, text message, or text file.
source
share