Click to See Complete Forum and Search --> : triming spaces within string? trim() not working


alexus
08-20-2006, 03:07 PM
Ok, hi
Im hawing hard time getting read of spaces...

I have string that is "Bank Account" it is pulled out from MySQL and was entered there by input form... I assume space is regilar.... I tried to use trim($string, " "); but it did not remove spaces!

Any ideas?

Thaks a lot!

bokeh
08-20-2006, 03:14 PM
trim removes space from the start and end of the string. Is that what you are trying to remove? Or mid-string?

pcthug
08-20-2006, 04:17 PM
If you are trying to remove all spaces use:

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