When users register to my website I want to allow them to use spaces in their username, but only one space per word.
My current code:
$usor = $_POST[
Use the following:
$username = preg_replace('/[\s]+', " ", $usor);
That will replace multiple spaces with a single space.