Jump to content

What's the best way to remove spaces from a string?


MortimerJazz

Recommended Posts

[quote author=MortimerJazz link=topic=122650.msg506076#msg506076 date=1168960705]
Is it using substr_replace()?
[/quote]

i know the [url=http://php.net/trim]trim()[/url] function has always worked for me. but taith's method seems to be more robust and efficient. thanks for the advice taith!
[quote author=taith link=topic=122650.msg506108#msg506108 date=1168963374]
no prob... trim() removes spaces from either side of a string, my str_replace() above removes all spaces from the string, wether it is at the end or between words...
[/quote]
AH that's the difference. good to know.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.