Page 1 of 1

[resolved] replacing a space with nothing

Posted: Mon Jul 31, 2006 12:29 pm
by ibanez270dx
Hi,
I need to have a little snippit of code that takes out all of the spaces from a variable. For example, I need to replace " " with "" from $variable. If you can understand what I mean, please help!

Thanks,
- Jeff

Posted: Mon Jul 31, 2006 12:31 pm
by klarinetking
Hi,

str_replace

ie

Code: Select all

$variable = str_replace(' ', '', $variable)
klarinetking

Posted: Mon Jul 31, 2006 12:32 pm
by pickle

Code: Select all

str_replace(' ','',$string);
The PHP manual is your friend: str_replace()

Posted: Mon Jul 31, 2006 1:02 pm
by ibanez270dx
awesome, thanks!