FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » 500. Turbo Sort
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: 500. Turbo Sort [message #172622 is a reply to message #172621] Tue, 22 February 2011 09:47 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
Álvaro G. Vicario wrote:
> El 22/02/2011 6:00, n00m escribió/wrote:
>> Actually I sort (in usual sense) nothing.But my output is sorted, of
>> course.
>>
>>> Shouldn't it be $i++ not ++$i on the for loop?
>>
>> And what's the difference (I refer only to my code above)?
>> It's because my fingers like a bit more to press "++" first, then the
>> rest.
>> A kind of mechanical habit.
>
> It's documented here:
>
> http://es2.php.net/manual/en/language.operators.increment.php
>
>
But since the value of $i is not tested in that statement, it makes no
difference.

It does in the sort of statement like while($i++<10); versus while(++$i<10)

I think. I NEVER EVER use an increment operator in a test statement
because if I can't remember, chances are the next person to read the
code wont, either.

Always ask yourself, 'how stupid, lazy & forgetful can I be on a Bad
Monday morning in February, double it, and assume the guy who has to
maintain your code is worse'

THEN when you come back to your code on that morning after a row with
your other half, ha raging hangover and you crashed the car on the way
in, you stand some chance of being able to find the bug as well;-)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to read/to download attachment on an URI?
Next Topic: Proxy to open blocked sites
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 23:21:26 GMT 2024

Total time taken to generate the page: 0.05370 seconds