Re: A compress function?

From: Date: Fri, 04 Jan 2002 13:47:02 +0000
Subject: Re: A compress function?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-79453@lists.php.net to get a copy of this message
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

« previous php.general (#79453) next »