RE: [PHP] stripping white space?

From: Date: Tue, 10 Jul 2001 05:09:17 +0000
Subject: RE: [PHP] stripping white space?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-57069@lists.php.net to get a copy of this message
You can't do that...deleting ALL spaces will screw up your content... Try str_replace("\n","",$var) to strip newlines, then a preg_replace("/\s+/"," ",$var) to strip all multiple spaces down to one... Haven't tested this syntax, but should be about right... jack -----Original Message----- From: Mukul Sabharwal [mailto:mukulsabharwal@yahoo.com] Sent: Tuesday, July 10, 2001 1:05 AM To: Kurt Lieber; php-general@lists.php.net Subject: Re: [PHP] stripping white space? Hi, I take that you simply want to remove ALL whitespaces from a data block (variable). you could simply use str_replace(" ", "", $var); --- Kurt Lieber <php@internalcombustion.com> wrote: > Is there a way using PHP to easily strip white space > out of an html page as > it's being sent to the client. That is to say, the > page that we as > developers work on is nicely formatted, indented, > etc. but when it's sent > out to the client, PHP will remove all the extra > white space both to > obfuscate the code and reduce the size a bit. > > For anyone who knows Cold Fusion, I'm looking for > the PHP equivalent of the > "Suppress whitespace by default" option in the Cold > Fusion Server > Administrator. > > (NOTE: I'm not looking for a discussion on the > merits of stripping vs. not > stripping white space characters or whether or not > it really does any > good -- I just want to know if it can be done easily > using PHP) > > Thanks. > > --kurt > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > php-general-unsubscribe@lists.php.net > For additional commands, e-mail: > php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > ===== ********************************* http://www.geocities.com/mimodit ********************************* __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#57069) next »