How to remove all whitespaces of a string in PHP
In this tutorial, we are going to learn about how to remove the all whitespaces of a string in PHP.
Removing all whitespaces
To remove all whitespaces of a string, we can use the built-in str_replace() method in PHP.
Here is an example:
$str = str_replace(" ","", "hello you can see me without spaces"); echo $str;