PHP - reduce multiple consecutive spaces to a single space

A PHP function that reduces multiple consecutive spaces in a string to one single space, so something like "   " is reduced to " ".

function reduceMultipleSpacesToSingleSpace($text) {
  return preg_replace('/\s+/', " ", $text );
}