Page 1 of 1

Problem with logical > (????)

Posted: Thu Aug 24, 2006 9:51 pm
by mparker1113
Hello:

I had to search for a very long time through eons(ish) of code to find that my code is saying:

Code: Select all

if( $granchildID > $highestID) 
{ 
         echo("grandkid advances at id = $grandchildID<br>");
         $highestID  = $grandchildID; 
}

else echo("grandkid of $grandchildID is not higher than $highestID<br>");
That $grandchildID is not greater than $highestID, even though what they print out from this scrippet is:
grandkid of 1022 is not higher than 1020
Now, how can this be, oh wise ones. We use scalar variables, right? Sigh, i just changed the code to add 0 to each variable in the logic test, with the same results.

Please help me look smart on this

>Mike[/quote]

Posted: Thu Aug 24, 2006 9:52 pm
by feyd
General Discussion is not the place to post coding problems.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:1. Select the correct board for your query. Take some time to read the guidelines in the sticky topic.

Posted: Fri Aug 25, 2006 2:17 am
by volka
if( $granchildID > $highestID)
d is missing.

figures -- thank you for babysitting me

Posted: Fri Aug 25, 2006 3:05 pm
by mparker1113
really -- thank you

Posted: Fri Aug 25, 2006 8:53 pm
by Ollie Saunders
volka wrote:
if( $granchildID > $highestID)
d is missing.
Good catch.

parker: make sure you have:

Code: Select all

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
So PHP tells you about these things.

Posted: Fri Aug 25, 2006 10:41 pm
by RobertGonzalez
Just make sure these settings are on your development machine. Always turn off display_errors for production environments.