How to Strip All Spaces Out of a String in PHP?

Posted by Prem Tiwari | Updated on

In this example you will learn, how to Strip All Spaces Out of a String in PHP. You can simply use the PHP str_replace() function to strip or remove all spaces inside a string.

Let’s take a look at the following example to see how it actually works:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers