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: Re[2]: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Robert Cummings
On Wed, 2004-03-17 at 12:19, Jason Wong wrote: > On Thursday 18 March 2004 01:07, Richard Davey wrote: > > > ++ is a _post_ increment. This means it'll returns $correct first and > > then increment it by one. There is a section in the PHP manual on this > > (search for "Incrementing/Decrementing O

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: Re[2]: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Jason Wong
On Thursday 18 March 2004 01:07, Richard Davey wrote: > ++ is a _post_ increment. This means it'll returns $correct first and > then increment it by one. There is a section in the PHP manual on this > (search for "Incrementing/Decrementing Operators". Whether it's pre or post depends on whether i

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[2]: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Richard Davey
Hello Sam, Wednesday, March 17, 2004, 5:04:21 PM, you wrote: SM> This drove me nuts for a while and instead of doing $variable++ I SM> started using ++$variable and never had the problem again. Yes, that's a pre-increment operator. Quite different to a post-increment. You need to use the right o

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[2]: [PHP] Simple: Whats wrong with this?

2004-03-17 Thread Richard Davey
Hello Jake, Wednesday, March 17, 2004, 5:00:52 PM, you wrote: >> $correct++; JM> Does this always work? In my timesheet app, I have to do $counter = $counter JM> + 1, because for some reason the $counter++; doesn't work. It just doesn't JM> work, no incrementation of the variable. Is there somet

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

[PHP] Simple: Whats wrong with this?

2004-03-17 Thread Shane McBride
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)) { $correct = 0; } else { $correct = $correct++; } Seems like it should work? Thanks! Shane -- PHP General Mailing List (http://ww