RE: [PHP] Simple: Whats wrong with this?

2004-03-18 Thread Chris W. Parker
Ford, Mike on Thursday, March 18, 2004 5:02 AM said: > Not quite -- the increment is performed immediately after the access > -- in fact, as part of the same operation. So: > > $x = 3; > $y = ($x++ * 2) + $x; > > is likely to give you $y==10, not 9. i see. good example. chris.

RE: [PHP] Simple: Whats wrong with this?

2004-03-18 Thread Ford, Mike [LSS]
On 17 March 2004 17:09, Chris W. Parker wrote: > > $var++ is a post incrementer meaning the value is updated at the next > command*. > * i'm not exactly sure how the compiler determines when to post > increment, but i think i'm correct. Not quite -- the increment is performed immediately after

Re: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Jake McHenry
wasn't a big deal, as long as it worked. Jake - Original Message - From: "Adam Voigt" <[EMAIL PROTECTED]> To: "Shane McBride" <[EMAIL PROTECTED]> Cc: "PHP" <[EMAIL PROTECTED]> Sent: Wednesday, March 17, 2004 12:05 PM Subject: RE: [P

RE: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Chris W. Parker
Shane McBride on Wednesday, March 17, 2004 9:40 AM said: > No, the value still is not incrementing. then you must be resetting it unknowingly or the else block in your if..else statement is not being executed like you are expecting it to be. one thing i do to debug

RE: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Shane McBride
No, the value still is not incrementing. -Original Message- From: Chris W. Parker [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 12:25 PM To: Shane McBride; PHP; [EMAIL PROTECTED] Subject: RE: [PHP] Simple: Whats wrong with this? Shane McBride <mailto:[EMAIL PROTEC

RE: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Chris W. Parker
Shane McBride on Wednesday, March 17, 2004 9:16 AM said: > I am just trying to get the variable to increment, than I will be > working on a session. It's basically being used to keep track of > correct/incorrect answers for an online quiz. and so now that you've cor

RE: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Shane McBride
$correct++ } Shane -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 12:06 PM To: Shane McBride Cc: PHP Subject: RE: [PHP] Simple: Whats wrong with this? Well I accidentally deleted your original email, but I didn't see where you were gett

RE: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Chris W. Parker
Jake McHenry on Wednesday, March 17, 2004 9:01 AM said: > Does this always work? In my timesheet app, I have to do $counter = > $counter + 1, because for some reason the $counter++; doesn't work. > It just doesn't work, no incrementation of the variable. Is there > s

Re: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Red Wingate
Maybe you guys should take a read about pre- and post-increment :-) Sam Masiello wrote: This drove me nuts for a while and instead of doing $variable++ I started using ++$variable and never had the problem again. --Sam Jake McHenry wrote: No. $correct++; Is all you need for the second conditio

RE: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Adam Voigt
7 at 12:05, Shane McBride wrote: > It doesn't seem to work either way for me. > > Shane > > -Original Message- > From: Jake McHenry [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 17, 2004 12:01 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] S

RE: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Sam Masiello
This drove me nuts for a while and instead of doing $variable++ I started using ++$variable and never had the problem again. --Sam Jake McHenry wrote: >> No. >> >> $correct++; >> >> Is all you need for the second condition, it automatically sets >> itself back. >> > > > Does this always w

Re: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Adam Voigt
Not that I'm aware of. In every incantation I've ever seen of the incrementing, $correct++; Is always, 100% equal to: $correct = ($correct + 1); But, maybe you ran into a case where it's not, you never know. On Wed, 2004-03-17 at 12:00, Jake McHenry wrote: > > No. > > > > $correct++; > > > > I

RE: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Shane McBride
It doesn't seem to work either way for me. Shane -Original Message- From: Jake McHenry [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 12:01 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Simple: Whats wrong with this? > No. > > $correct++; > > Is all you

Re: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Jake McHenry
> No. > > $correct++; > > Is all you need for the second condition, it automatically sets itself > back. > Does this always work? In my timesheet app, I have to do $counter = $counter + 1, because for some reason the $counter++; doesn't work. It just doesn't work, no incrementation of the variabl

Re: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Adam Voigt
No. $correct++; Is all you need for the second condition, it automatically sets itself back. On Wed, 2004-03-17 at 11:52, Shane McBride wrote: > I have a form variable I want to increment by a value of 1 each time the > page loads. Here's what I have so far: > > if(!isset($correct)) { >