note 9068 added to trim
| From: | markus at frosch-digital dot de | Date: | Fri, 13 Oct 2000 18:25:34 +0000 |
| Subject: | note 9068 added to trim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6456@lists.php.net to get a copy of this message | ||
If you want shrink some whitespace to one from a string, you need to use this code:
$pizza = "Teil1 Teil2 Teil3 Teil4 Teil5 Teil6 df";
$pieces = explode (" ", $pizza);
$pizza = "";
while ( list(,$p) = each($pieces) )
{
if ($p!="") { $pizza = $pizza . $p . " "; }
}
$pizza = rtrim ($pizza);
http://www.php.net/manual/de/function.trim.php