Re: Getting rid of extra lines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miller, Terion wrote:
> I am trying to get rid of empty whitespace lines, I can't us chop() because
> as I read it it will remove all whitespaces....right?
> 
> Right now my db is outputting with extra lines, I have stripped tags I know
> it isn't that causing it to look like this
> 
> Blahlajdlkfjlksdjflkdjsf
> 
>                <--------------how do I get rid of all this extra space?
> 
> alkdfjlsdakjflsakdjflksjdf
> 
> 

If the white space is included in data coming from the db you could run
a simple little regex on the variable to removed any repetitive white
space.  But it might not be the best way to do it.

	$clean = preg_replace('|\s+|', ' ', $input);
or
	$clean = preg_replace('|\s{2,}|', ' ', $input);

If the white space is being generated in your HTML output, but is not in
your data store, then you need to cleanup your PHP code and that might help.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux