Project

General

Profile

Actions

Task #54871

closed

Use pre-increment and decrement operators

Added by Michiel Roos over 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2014-01-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
no-brainer
Sprint Focus:

Description

Variables can be incremented in pre style (+$i) or post style ($i+).

If the result of the operation is not assigned to a variable or otherwise directly used, pre should be used instead of post.

This is due to the fact that (under the hood) an extra variable assignment is taking place on post increment.

Yes it's a nano-opimization.

But I would like to see it used throughout the core as a 'best practice'.

Regex to find them: /[^=]\s*\$[a-zA-Z0-9]*(\+\+|\-\-)\s*;/

Actions

Also available in: Atom PDF