Actions
Task #55518
closedUse variable array access instead of strlen($a) > 0
Start date:
2014-01-31
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
no-brainer
Sprint Focus:
Description
Checking if a string has any length greater than 0 characters can be done cheaply using variable array access:
Use:
if ($string{0}) {
Instead of:
if (strlen($string) > 0) {
if (strlen($string)) {
Updated by Michiel Roos almost 11 years ago
How to find them:
/if\s*\(strlen\s*\([^\(\)]+\)( > 0)?\)/
Updated by Michiel Roos almost 11 years ago
Please close this issue, http://forge.typo3.org/issues/54091 fixes this in a more readable way.
Actions