note 32446 added to function.ereg-replace

From: Date: Wed, 28 May 2003 02:20:20 +0000
Subject: note 32446 added to function.ereg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-49143@lists.php.net to get a copy of this message
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; ---- Manual Page -- http://www.php.net/manual/en/function.ereg-replace.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32446 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32446&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32446&report=yes

« previous php.notes (#49143) next »