Re: problem using &&

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

 



tedd wrote:
>> php@xxxxxxxxx wrote:
>>>
>>>  On Wed, 26 Jul 2006 13:54:15 +0200, Jochem Maas
>>> <jochem@xxxxxxxxxxxxx> wrote:
>>>>  var_dump($out, $u, $p, (" user " == "user"));
>>>
>>>  Jochem
>>>  Thank you, var_dump showed me i had an extra space at the end of the
>>> password. I trimmed the vales from the file and it works fine now.
>>
>> LOL - that's one lesson/trick you probably won't forget in a hurry...
>> most of us have had similar experiences at one time or the other!
> 
> Jochem:
> 
> How did you know that he had an extra space in $u?
> 
> I reviewed his code and didn't see anywhere where he defined it in his
> post.
> 
> Are you clairvoyant?   :-)

no my dear watson, it's rather elementary.

1. I read his code and it was fine in principle
2. I checked the code with some known values, this confirmed 1
3. given that the expression was evaluating to false it had to be
   either a case of:

	a, the array was not in the form the OP thought it was
	b, the values of the array were the other way around than the OP thought they were
	c, the values were not what the OP thought they were

   given that he was adament that niether a, nor b, was the case this only left c,.
4. although the OP stated the values were the same he also mentioned he was using 'echo'
   to display the values - whitespace does not show with 'echo' but does make a difference
   when comparing strings, which explains the mismatch nicely.

PS - If I had a penny for every time I have made the same kind of mistake I would be
paying someone else to write this. needless to say I use a lot of trim()s

;-)

> 
> tedd

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