Re: Strip_tags issue / question

From: Date: Mon, 03 May 2004 17:10:01 +0000
Subject: Re: Strip_tags issue / question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185210@lists.php.net to get a copy of this message
Dave Carrera wrote:
Hi List, I am using stip_tags to return to me just the words contained in a page from my website but what is displayed is some thing like this : --- Output Example --- hello world Why so much space ? --- End ----- So where the tags were, whitespace is inserted or kept. Is there a way to remove the whitespace so that the output is something like this? I have tried "trim()" "prg_replace()" str_replace(' ','',$contents) but none of these seem to work. --- Example of what I want --- Hello world why so much space ? --- End --- Thank you in advance for any help or pointers with this one. Dave C --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.672 / Virus Database: 434 - Release Date: 28/04/2004
You could try: $text = preg_replace('/\s+/', ' ', $text); This will replace multiple whitespace chars with one space. -- paperCrane <Justin Patrin>

« previous php.general (#185210) next »