You are here: Re: [PHP] Comparing of string « PHP « IT news, forums, messages
Re: [PHP] Comparing of string

Posted by janbro on 10/04/91 11:36

Hi Jeremy,
I tried if ( strcmp( trim($SollKombination), trim($formCheck) ) )

same negativ result. For some reason both strings are not considered to be the same.
They have the same length, are of the same type and have the same content. Why PHP
doesn't recognize them as beeing equal.... I don't get it.

thanks for your help so far
janbro

Jeremy Privett schrieb:
> janbro wrote:
>
>> 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
>>
>>
>>
> Hey JanBro,
>
> Try replacing the if statement you have with this:
>
> if ( strcmp( trim($SollKombination), trim($formCheck) ) ) {
> echo "test";
> }
>
> ---
> Jeremy Privett [ http://www.jeremyprivett.com ]
> Founder - Lead Software Developer - Hosting Systems Administrator
> Omega Vortex
> (http://www.omegavortex.com)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация