Martin Lindhe wrote:
> 
> Bug in str_replace(), PHP 4.0.6
> 
>         $text = "hello   world";
>         $out = str_replace("  "," ",$text);
>         echo $out;
> 
> Expected output:
>         "hello world"
> 
> Actual output:
>         "hello  world"
> 
> Of course, this is what happens if str_replace() does replacements on input,
> but not on the soon-to-be output it is working on. Is this to be expected,
> or would it be ok to modify the functionality of str_replace()?

Huh?  It did exactly what you asked to do.  You had three spaces, and you
requested that two be replaced by one.  So, you went from three spaces to two
spaces, as two of the three were combined into one.  I don't understand why
you expected to end up with one space.  Can you elaborate please?

Thanks,
Chris

-- 
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