php remove multiple whitespace code example Example: remove every whitespace php $string = preg_replace('/\s+/', '', $string);