On Jan 2, 2008 12:58 PM, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Wed, January 2, 2008 2:09 pm, tedd wrote:
> > At 1:25 PM -0600 1/2/08, Jack Mays wrote:
> >>>>
> >>>>>On Jan 2, 2008 1:34 PM, tedd <[EMAIL PROTECTED]> wrote:
> >>>>from this:
> >>>>
> >>>> A
> >>>>
> >>>>to this A
> >>
> >>Read the docs for trim, you can't use it inline with other
> >>functions, it will not trim the input. you have to seperate it out,
> >>e.g.:
> >>
> >> $submit = str_replace(' ','',$submit);
> >> $submit = trim($submit);
> >
> > But, that still doesn't work.
> >
> > Go from here:
> >
> > A
> >
> > to here:
> >
> > A
>
> Works for me:
>
> [EMAIL PROTECTED] ~/cd $ php -a
> Interactive mode enabled
>
> <?php
> $a = ' A ';
> $b = str_replace(' ', '', $a);
> echo "b: $b\n\n";
> $c = trim($b);
> echo "c: $c\n\n";
> ?>
> b: A
>
> c: A
>
>
> [EMAIL PROTECTED] ~/cd $
>
> --
> 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
>
>
OKAY. Let's clarify.
Here's the string in HTML:
A
The browser then passes it to GET/POST. It decodes the entities, and
then urlencodes them. Now it looks like this:
%a0%20%a0%20%a0%20%a0A%a0%20%a0%20%a0%20%a0
Then PHP receives it, urldecodes the string, then stuffs it inside
$_POST, $_GET, $_REQUEST, etc. Now it's like this:
A
$_POST['submit'] == ' A ' // TRUE.
... *pokes my solution*...
$value = trim($value, chr(32) . chr(160));
--
-Casey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php