Hi! Phil: Still I am curious what var_dump($userValues['afterDark']); at line 102.5 would return. I managed to recreate that fault with $var['test'] = "blah"; echo ($var['test']); if( $var['test'] == 0) { echo "ok"; } //this returns blahok -- not expected. In my case Var_dump() returns string(4) "blah" as expected. Using if( $var['test'] === 0) behaves as expected!! Jim: TypeCasting would only be effective if you used the type sensitive comparison operator === , because with "==" 0 equals NULL equals false equals "" and so on ... or do I miss something here?? Hope that solves it for you! I'm still investigating why my first examples fails. I've got the strong feeling that I'm missing something there. I don't believe in a php bug or a memory leak in this case! Must be something pretty obvious! Anyone a clue?? Thanks, Jan -----Original Message----- From: Jim Lucas [mailto:lists@xxxxxxxxx] Sent: Thursday, August 09, 2007 8:08 PM To: Stut Cc: Phil Curry; php-general Subject: Re: I know this is not easy and I'm not stupid but... Stut wrote: > Please include the list when replying. > > Phil Curry wrote: >>> Phil Curry wrote: >>>> how can this be? This is not the first time I've run into a >>>> situation like this. What am I missing? >>>> line 102 echo ($userValues['afterDark']); // outputs 1 >>>> line 103 if ( $userValues['afterDark'] == 0 ) { // passes >>> >>> Add a line at 102.5... >>> >>> var_dump($userValues['afterDark']); >>> >>> What type is that variable? >> >> Don't have to do a dump, I know its a tinyint(1), not null, default 0 PHP does not have a type of tinyint knowing now that this comes from a database, if it is mysql, then it is of type string PHP converts all fields when pulled from the database into strings. It does not take into account what type the field is actually set to in mysql. Try puting a (int) in front of the condition like this if ( (int)$userValues['afterDark'] == 0 ) { ... } Maybe this will help > > That would be the type in the database, not the type of that variable at > that time. > > -Stut > -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- 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