remove all spaces php
snippet in php

remove empty spaces php

user737

$string = str_replace(' ', '', $string);

remove every whitespace php

user4496

$string = preg_replace('/\s+/', '', $string);

remove all spaces php

user5344

$string = "this is my     string"
$string = preg_replace('/\s+/', '', $string);