/    Sign up×
Community /Pin to ProfileBookmark

triming spaces within string? trim() not working

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!

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@bokehAug 20.2006 — trim removes space from the start and end of the string. Is that what you are trying to remove? Or mid-string?
Copy linkTweet thisAlerts:
@pcthugAug 20.2006 — If you are trying to remove all spaces use:
[code=php]
$string = str_replace(' ', '', $string);
[/code]
×

Success!

Help @alexus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...