note 32446 deleted from function.ereg-replace by tularis

From: Date: Sun, 29 Aug 2004 12:13:20 +0000
Subject: note 32446 deleted from function.ereg-replace by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75555@lists.php.net to get a copy of this message
Note Submitter: acidfilez at nexusnet dot cl (Magno C dot Heck) ---- lots of examples on how to trim spaces, but what about to ouput this correctly (remind you that browser prints all of the below like: <br>"hi magno cardona") <?php $test = " hi magno cardona hi magno cardona hi magno cardona hi magno cardona hi magno cardona"; $test = ereg_replace("([ ]{2})","\\1&nbsp;",$test); echo $test; ?> final HTML OUPUT will be: hi magno cardona hi &nbsp;magno cardona hi &nbsp; magno cardona hi &nbsp; &nbsp;magno cardona hi &nbsp; &nbsp; magno cardona which is excatly the same in html, without over abusing the &nbsp;

« previous php.notes (#75555) next »