When using the ++ operator by itself on a variable, ++$var is faster than $var++ and uses slightly less memory (in my experiments). It would seem like this could be optimized in the language during runtime (if $var++ is the only thing in the whole statement, it could be treated as ++$var).

I conducted many tests (I believe to be fair), and here's one of the results:

$i++ took 8.47515535355 seconds and 2360 bytes++$i took 7.80081486702 seconds and 2160 bytes

Here's my code. If anyone sees a bias in it, tell me. I conducted it many times, each time going through a loop one million iterations and doing each test 10 - 15 times (10 - 15 million uses of the ++ operator).

Regarding character incrementing and PHP following Perl's convention with character operations.Actually i found that there is a difference, and incrementing and decrementing unfortunately does not yield the reverse, expected results.For example, the following piece of code:<?phpecho '== Alphabets ==' . PHP_EOL;$s = 'W';for ($n=0; $n<10; $n++) { echo ++$s . ' ';}echo PHP_EOL;

(related to what "Are Pedersen" wrote)With arrays it can lead to much confusion if your index variable is altered on the right side of the = sign, either with ++|-- or even when passed to a function by reference..Consider these (PHP 5):<?php$A[$a] = ++$a; // [1]=1$B[++$b] = ++$b; // [1]=2$C[$c+=0] = ++$c; // [0]=1?>In 'A' you have to be aware that PHP evaluates $A[$a] last.Yet in 'B' and 'C' PHP evaluates the index and saves it in a temporary variable.

You can always force PHP to evaluate a variable without explicitly storing it as a named variable first, with a simple "+=0" like in example 'C'.

Compared to 'A', 'C' gives the more logically expected result, when we expect evaluation occurs left to right.PHP does evaluate left to right BUT it will attempt to cut down on temporary variables, which can lead to confusing results.

So just be aware and use either behavior to your advantage for the desired functionality.