How to remove whilespace from string in php?

To remove multiple occurences of whitespace characters in a string an convert them all into single spaces in php.

1. Code:

      

2. Example:

Input:

"Soltuts.com       is   providing      PHP tutorials,      tips,     tricks      and code snippets"

Output:

Soltuts.com is providing PHP tutorials, tips, tricks and code snippets