In this tutorial, we are going to learn about how to remove the all whitespaces of a string in PHP.
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;