PHP Regular Expression Exercises: Remove the whitespaces from a string
PHP regular expression: Exercise-3 with Solution
Write a PHP script that removes the whitespaces from a string.
Sample string : 'The quick " " brown fox'
<?php $str1 = 'The quick " " brown fox'; echo preg_replace('/\s+/', '', $str1)."\n"; ?>
PHP Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?