note 76491 added to function.str-replace

From: Date: Tue, 17 Jul 2007 18:40:53 +0000
Subject: note 76491 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-128675@lists.php.net to get a copy of this message
I get annoyed when double triple and more spaces in a row get in the way of my code as they count as characters in wordwrap and therefore ruin the look of the page as the spaces wont show up to the user but the writing look uneaven as the wordwraping has counted the spaces so this might help someone else having this problem. Pretty simple but should work. <?php while(strpos($string, " ")) { $string = str_replace(" ", " ", $string); } ?> Simple but effective code. ---- Server IP: 87.124.64.96 Probable Submitter: 86.112.225.76 ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- https://master.php.net/note/edit/76491 Del: integrated -- https://master.php.net/note/delete/76491/integrated Del: useless -- https://master.php.net/note/delete/76491/useless Del: bad code -- https://master.php.net/note/delete/76491/bad+code Del: spam -- https://master.php.net/note/delete/76491/spam Del: non-english -- https://master.php.net/note/delete/76491/non-english Del: in docs -- https://master.php.net/note/delete/76491/in+docs Del: other reasons-- https://master.php.net/note/delete/76491 Reject -- https://master.php.net/note/reject/76491 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128675) next »