Random black space with a limit

I’m looking for a way to create a string contaning a random amount of spaces, here’s what I’ve tried so far but I only get one space…

[embed=425,349]$s = substr(str_shuffle(" "), -5);

echo (‘space’ . $s . ‘space’);
?>[/embed]

I only added the ‘space’ so I could axctually see them in phpfiddle

Multiple spaces render as one space in html. You would need to use a non-breaking space -  

ah, perhaps my script was working then, I’m actually trying to save the spaces into a database.

What is the big picture of what you are doing? This is clearly an XY Problem.

You are saving space to a database? And the value of that is what exactly?

Sponsor our Newsletter | Privacy Policy | Terms of Service