123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|642|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Web Development -> Stripping tabs in PHP

Mon, 09 Apr 2007, 00:09
HoboBen
Quick Q:

How do I go about stipping tabs from a string in PHP?

I seem to be able to do anything else, like spaces and words OK.

I've googled a bit, but got confused.

How do I manage

please?

Much ta

-=-=-
blog | work | code | more code
Mon, 09 Apr 2007, 00:47
shroom_monk
Well, I've only just started PHP... *looks into PHP book...*

Hmmm... aha!

trim() is designed to knock off all whitespace from a string. That might help.
uk3.php.net/trim

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Mon, 09 Apr 2007, 05:15
ingenium1
$t = "abba babba";
$t = str_replace(" ", "",$t);

Result:
abbababba

-=-=-
Roger Federer is go(o)d.
But he is not alone.

Just relax... sometimes there's no need to argue.
Mon, 09 Apr 2007, 07:24
Phoenix
Or, rather:
$t = str_replace("\t", "",$t);
Tue, 10 Apr 2007, 15:38
HoboBen
That looks promising. Cheers, phoenix. I never thought that a tab would be treated like a newline or other special instances, so I was treating it as text all along.

Thanks

@ingenium... I'd already been trying $t = str_replace(" ", "",$t); but it didn't do anything.

@Shroom, I would have used that but I'm stripping from the middle of a string, however if I'd looked at that page properly, I should've been able to figure it out Cheers



-=-=-
blog | work | code | more code
Tue, 10 Apr 2007, 15:58
mike_g
\t should be it. Its the same in C if you want to put tabs in strings and stuff.
Tue, 10 Apr 2007, 16:00
HoboBen
Yup, just tested and it worked

Thanks everyone

-=-=-
blog | work | code | more code