Re: [PHP] PHP: inexplicable behaviour of pre- and post-increment operators

2010-03-03 Thread clancy_1
On Wed, 3 Mar 2010 08:21:06 -0600, halip...@gmail.com (haliphax) wrote: >> On Fri, Feb 26, 2010 at 11:01 PM, wrote: >> > while ($i < $j) { $b[$i] = $a[$i++]; } B. >> > >> > You get $b[0] = $a[1], and so on (as you would expect). >> > >Wouldn't that be $b[0] = $a[0], with the value of $i

Re: [PHP] PHP: inexplicable behaviour of pre- and post-increment operators

2010-03-03 Thread haliphax
> On Fri, Feb 26, 2010 at 11:01 PM, wrote: > > while ($i < $j) { $b[$i] = $a[$i++]; } B. > > > > You get $b[0] = $a[1], and so on (as you would expect). > Wouldn't that be $b[0] = $a[0], with the value of $i being 1 *after* the statement was finished executing? You used a post-decrement

Re: [PHP] PHP: inexplicable behaviour of pre- and post-increment operators

2010-03-02 Thread Adam Richardson
Thanks for taking time to provide the examples, Clancy, I'll know what potential pitfalls to wary of now :) On Fri, Feb 26, 2010 at 11:01 PM, wrote: > A week ago Dasn asked a question about converting arrays, and I quoted one > possible way of > achieving his task, using the operation: > > $i =

[PHP] PHP: inexplicable behaviour of pre- and post-increment operators

2010-02-26 Thread clancy_1
A week ago Dasn asked a question about converting arrays, and I quoted one possible way of achieving his task, using the operation: $i = 0; while ($i < $k) { $b[$a[$i++]] = $a[$i++]; } I added the comment that "I have always been wary of using statements like this because I was unsure when the