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