RE: [PHP] remove spaces using php function
| From: | Javier Tacon | Date: | Tue, 07 Oct 2003 09:23:40 +0000 |
| Subject: | RE: [PHP] remove spaces using php function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-165276@lists.php.net to get a copy of this message | ||
Well, you can make your own function to to that:
<?php
function repairString($input) {
$string = NULL;
$iTmp=explode(" ",$input);
foreach($iTmp as $word) { if($word!="") $string.="$word "; }
return trim($string);
}
print repairString("this is a test "); // prints "this is a test"
?>
Javier Tacón
-----Mensaje original-----
De: Uma Shankari T. [mailto:umashankari@lantana.tenet.res.in]
Enviado el: martes, 07 de octubre de 2003 11:15
Para: PHP
Asunto: [PHP] remove spaces using php function
Importancia: Baja
Hello,
Is there any function which will remove extra spaces between each
words..??
for example if the user typed
asked his friend..
is there any function to remove the extra space between his and asked
except one space ??
Regards,
Uma
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php