How to replace blanks in a string in PHP

To replace blanks in a string in PHP you can use the following snippet.

Sample PHP

$stringOne = "This is a Test!";  
$stringTwo = str_replace(" ", "", $stringOne);  

Please Share us:
Please rate this snippet

2 thoughts on “How to replace blanks in a string in PHP

Leave a Reply