On 26 April 2009 22:59, PJ advised:

> kranthi wrote:
>> if $Count1 is never referenced after this, then certainly this
>> assignment operation is redundent. but assignment is not the ONLY
>> operation of this statement. if u hav not noticed a post increment
>> operator has been used which will affect the value of $Count as well,
>> and this operation is required for the script to work.
>> the script should work even if u replace
>> $Count1 = $Count++;
>> with
>> $Count++;
>> Kranthi.
> Not quite, since that would change the $Count variable and
> that is used
> leater in the code.

Um -- I must be missing something here, because those two statements
have exactly the same effect on $Count, incrementing it by one (and you
said the first statement fixed your problem, so logically the second one
must too).

In fact, because you've used a post-increment, the statement

   $Count1 = $Count++;

ends up with $Count == $Count1+1, and $Count1 being the original value
of $Count!!

This whole scenario smacks to me of a classic "off-by-one" error --
either $Count actually *needs* to be one greater than the value you
first thought of, or some other value you are comparing it to should be
one smaller than it actually is.



Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.f...@leedsmet.ac.uk
Tel: +44 113 812 4730

To view the terms under which this email is distributed, please go to 

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to