Your text is rendered correctly.
A tab does not mean a fixed number of spaces or a printable character. It means "forward the cursor to the next tab stop".
A tab stop in computers is typically set to every 4 or 8 characters. It's a display issue that will behave differently across various systems and user configurations.
If you copy your output to your preferred text editor and manually select it, you can see spaces as dots and tabs as lines, as in the examples below:
Note: your output is the first line ("ten seven fifteen"). I added the second and third lines to illustrate the configured tab length in the text editor.
If we set tab length to 4:
The first string contains 10 chars ("t", "e", "n" plus 7 dots), and the next tab stop is at the 12th char. So it's only 2 chars away, that's why your tab character (grey line) is only 2 chars long. The second string has 7 chars, and the next stop is only 1 char away so the tab will have only 1 char. It's the same logic for the third string.
If we set tab length to 8:
It follows the same logic, but in this example, the first tab is now bigger because the nearest stop is at position 16, so the tab has 6 chars. The second and third tabs have coincidentally only one char.
If we set tab length to an odd number like 3:
This is not common, but it's something possible. In this example, we can see all tabs as multiple spaces. It follows the same logic as explained above, but we can visually see that your code is producing the expected output.
Notice that I did not change your output in any way. I just played with the editor's configuration.
If you want a fixed length spacer between your chars, you should use "\s"
instead. You can repeat the character like this: "\s\s\s\s"
, or using str_repeat("\s", 4);
or "\s" * 4
if you were using Python.