Reply to Re: WHILE loop problems

Your name:

Reply:


Posted by Vince Morgan on 04/12/07 09:41

"peter" <submit@flexiwebhost.com> wrote in message
news:evklbr$u2u$1@aioe.org...

> I was referring to the way it was used by the previous op. The line in the
> code was $imagenum = $imagenum++; and someone advised him to use
> $imagenum++; instead and in the way it was being used it did not make any
> difference. If it had been used in the while statement and not in it's
body
> then yes it would have made a difference but in this case it did not as I
> stated.
>
>
What I worte was as follows;
>I think perhaps ++$imagenum would be more appropriate than $imagenum++.
>I can't see any purpose in post-incrementing the value here.
>But I am still a newbie to PHP.
>Vince

My reasoning is to do with normal usage, nothing more.
You are certainly right, the outcome is going to be the same regardless, if
used correctly within the body of the loop. But you clearly missed the
point.
"perhaps ++$imagenum would be more appropriate" simply meant to convey that
if you are not requiring side effects then the usage of pre-incrementation
is better IMHO as it's usage is immediately obvious when you, or especialy
someone else, is later reading the code.
If I come across code that uses a post-increment I begin to look for "why"
it was used.
It's a simple matter of semantics, nothing more.
"More appropriate" isn't the same as "should be" either, in case I need
later to explain that too.
Regards,
Vince

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация