This is how i used todo my for loops, it's called post-increment:
for ($i = 0; $i < 10; $i++) {}
- the value of
$i
copied to an internal temporary variable -
$i
is incremented - the internal copy of the old value of
$i
is returned
This is called pre-increment and it's 10% faster!
for ($i = 0; $i < 10; ++$i) {}
-
$i
is incremented - the new value is returned
Categorieën
PHP