On Wed, January 2, 2008 3:07 pm, Daniel Brown wrote:
> On Jan 2, 2008 3:58 PM, Richard Lynch <[EMAIL PROTECTED]> wrote:
>> Works for me:
>>
>> [EMAIL PROTECTED] ~/cd $ php -a
>> Interactive mode enabled
>>
>> <?php
>> $a = '&nbsp; &nbsp; &nbsp; &nbsp;A&nbsp; &nbsp; &nbsp; &nbsp;';
>> $b = str_replace('&nbsp;', '', $a);
>> echo "b: $b\n\n";
>> $c = trim($b);
>> echo "c: $c\n\n";
>> ?>
>> b:    A
>>
>> c: A
>
>     Tedd's problem is that it's not working on the web, though, Rich.
> I tested mine and it worked fine from the CLI, too, but not when
> encoded and then decoded via HTTP.

D'oh!

Of course &nbsp; in the browser is converted to a single character,
whose ASCII (extended ASCII, actually) value is 160.

trim() does not consider chr(160) as whitespace, unless you explicitly
add it in the second arg, along with the usual suspects.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to