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