Re: Comparing of string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi JanBro:

    Quick guess: are the strings the same length?  I've been bitten many
times by string comparisons that appear to be identical but which fail due
to trailing spaces, other "invisible" (i.e., non-printing) characters, and
the like.

    Hope this helps.

        Jon


----- Original Message -----
From: "janbro" <janbro@xxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Tuesday, January 03, 2006 11:22 PM
Subject:  Comparing of string


> Hello List
>
> I've got the following little code:
>
>                         $formCheck= $_GET['formCheck'];
>                         $SollKombination = $_SESSION['zufall'];
>
>                         echo "$SollKombination<br>$formCheck";
>                         print gettype($formCheck);
>                         echo "---";
>                         print gettype($SollKombination);
>
>
>                         if ($SollKombination == $formCheck){
>                                    echo "test";
>                         }
>
> To give you some background: This code is supposed to check if a user has
tried to login via my form.
>
> Which gives me the following  output:
>
> ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S
> ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S
> string---string
>
> Everything the way it's supposed to be....
>
> What I don't get is, why isn't the if statement true? Shouldn't it show
test as well? Where is my mistake?
> I run PHP 5.1.1 on Windows. On my Win PHP 5.0 this code works proper, but
not here ?!?
>
> thx JanBro
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux