Hey

> With all the wonderful String functions in PHP, I haven't been able to
find
> a str_compress().  Is there such an animal?  Let's say I have a string
like
> this:
>
> $myString = First_word  <30 spaces> second_word <10 spaces> etc...

This would proberly work:
----------------------------------
    function str_compress($stString) {

        if (substr_count($stString,'  ') == 0) {
            return $stString;
        }

        $stString = str_replace('  ',' ',$stString);

        return str_compress($stString);
    }


    echo str_compress('dsfsd fdf sdf     sdfd                     sf sf sdf
sf  s fdsf sdf    sdf sfsfsd sfs   sf ');
----------------------------------

Regards Emil

ps. I admit that I dont know if there is a built in function.

--
Emil Rasmussen
http://noget.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to