...

View Full Version : trim a string from every space



nst
10-31-2006, 05:38 PM
Is there a way to get rid of blank spaces in a variable?

e.g. $str = "foo f o o" should be "foofoo"

trim makes is good for the start and the end of the string, but what about the rest?

Thanks.

homerUK
10-31-2006, 05:44 PM
could you just do

$my_string = "foo f o o";
$str = str_replace(" ","",$my_string);

nst
10-31-2006, 06:28 PM
True!

So simple and great.

Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum