dcole.ath.cx Posted August 18, 2006 Share Posted August 18, 2006 the problem is $u = $i--; it should be $u = $i-1; that will atleast end you endless loop.. Link to comment Share on other sites More sharing options...
SFB Posted August 18, 2006 Author Share Posted August 18, 2006 . Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted August 18, 2006 Share Posted August 18, 2006 $i is changing.... $i-- makes $i one less than it was.$u = $i would make $u the same as $i, $u = $i-- would make $i one less then it was and then $u the same as $i. Link to comment Share on other sites More sharing options...
SFB Posted August 18, 2006 Author Share Posted August 18, 2006 . Link to comment Share on other sites More sharing options...
SFB Posted August 18, 2006 Author Share Posted August 18, 2006 . Link to comment Share on other sites More sharing options...
reportingsjr Posted August 18, 2006 Share Posted August 18, 2006 sfb, -- makes it go down one, since you did it to $i and not $u it makes $i go down and since you make $u equal to that they both change. just use this:$u--and it will subtract 1 Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted August 18, 2006 Share Posted August 18, 2006 sfb, -- makes it go down one, since you did it to $i and not $u it makes $i go down and since you make $u equal to that they both change. just use this:$u--and it will subtract 1 I think it got it since he posted a downloadable version... Link to comment Share on other sites More sharing options...
reportingsjr Posted August 18, 2006 Share Posted August 18, 2006 Yep . Just clarify . ... Link to comment Share on other sites More sharing options...
SFB Posted August 19, 2006 Author Share Posted August 19, 2006 . Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted August 19, 2006 Share Posted August 19, 2006 well you read it from center point out...it's like X = 5*(2+3)+1*6php can't just read it from left to right... it has to start in the () and do the +, then do the * then the other *, then the + out side the (), and finally get what X is equal to...you need to simplify both sides before crossing them! so $i-- is simplified to 0, then $s is equal to 0. Link to comment Share on other sites More sharing options...
SFB Posted August 19, 2006 Author Share Posted August 19, 2006 . Link to comment Share on other sites More sharing options...
reportingsjr Posted August 19, 2006 Share Posted August 19, 2006 Because it doesnt work that way! Just leave it lol.. Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted August 19, 2006 Share Posted August 19, 2006 i understand that but why can't it I wish it could just change $i for only that one statement. if you had a list of math problems and you were told that x=12 to all of them the value of x would not change after you did the first problem.but this is the same page, the same problem... if it was a new problem or in php a new page... then it would be the way you want it. Link to comment Share on other sites More sharing options...
SFB Posted August 20, 2006 Author Share Posted August 20, 2006 the new location of my captcha is http://php-scripts.ath.cx/captcha Link to comment Share on other sites More sharing options...
justsomeguy Posted August 21, 2006 Share Posted August 21, 2006 it's like X = 5*(2+3)+1*6php can't just read it from left to right... it has to start in the () and do the +, then do the * then the other *, then the + out side the (), and finally get what X is equal to...That's assuming the operators have the same precedence. In that example, parentheses are used to force precedence, so they are evaluated first. Then the expression looks like this:X = 5*5+1*6Multiplication has a higher precedence then addition, so then the expression looks like this:X = 25+6And then the addition, and assigment (equals) has the lowest precedence besides the logical operators. You can see more about that stuff here:http://www.php.net/manual/en/language.oper...tors.precedence Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now