note 76491 deleted from function.str-replace by felipe

From: Date: Sun, 23 Mar 2008 23:05:46 +0000
Subject: note 76491 deleted from function.str-replace by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-137423@lists.php.net to get a copy of this message
Note Submitter: the-master at supanet dot com ---- 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.

« previous php.notes (#137423) next »