• Raul

    C’mon, this is much too easy! ;))

  • Not so easy it seems. I’ve made a strange observation while talking to people on this matter. Those who have an open source background say it’s really easy and give the correct answer and those that use Microsoft technologies (mainly .NET) will think about it a long time and finally give a wrong answer.

  • Raul

    I do not want to argue with you but THIS is basic information for beginners ! 😉

  • Yeah, Raul, only that some of the programmers forget tiny things like these… And most of them don’t know basic computer architecture like memory stack, buffers, registers, etc.

  • Raul

    Often I forget function names and required parameters but that’s why exists help files! It’s OK! On the other hand,increment operator is not tiny! It’s basic info! It could mess up everything!
    And frankly we are not in the 80’s anymore to know CPU’s registers! ;))

  • Raul

    PS: And I forget a lot of them … ;))

  • It’s about memory allocation. If you know how registers and stack work, you will never be wrong regarding the pre/post incrementation operators or regarding recursive functions. Btw, if you know all that (and it’s again basic information about a computer) you will write your code to be more fast on one architecture or another just by playing with the access times for memory (RAM) or registers.

  • It’s a pure theoretical issue. You won’t find stuff like this in real life. Hopefully…

  • I know it’s theoretical, but I can think of a situation where it may occur. A little typo bug in a couple of nested loops where you want to assign to a $j the value of $i then increment $i… I think I used something like this once, save for the typo 🙂

  • It was tricky for me. I’d have been sure about the answer if the problem had been:

    But, $i = $i++ really made me wonder what are the internals of the process…

Advertisment ad adsense adlogger