html basics, too 😉
the browser treats a sequence of spaces (or tabs) as one or skips them alltogether at the beginning of a line.
This makes some sense as it allows indentation and makes the html source code easier to read.
If you want the html output to show indentation, you'd have to convert spaces to no-break spaces, e.g.:
str_replace(' ', ' ', $string);
There is one drawback with this:
If you have very long entries, the browsers can't wrap lines automatically, just the way it is here in the forum:
echo " This is going to be a very long string with five spaces at the beginning. The spaces are displayed properly but now you will need a new monitor with a really high resolution to read this without scrolling all the time.";