Skip to main content
Code Review

Return to Answer

replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
Source Link

Does performance really matter? It seems premature optimization premature optimization.

Actually, I'd rewrite the last part to a more readable form:

$classCount = 0;
if ($foundLetter) {
 $classCount++;
}
if ($foundNumber) {
 $classCount++;
}
if ($foundSymbol) {
 $classCount++;
}
if ($classCount >= 2) {
 return true;
}
return false;

It would be more important and less error-prone if you have more than three character classes.

Does performance really matter? It seems premature optimization.

Actually, I'd rewrite the last part to a more readable form:

$classCount = 0;
if ($foundLetter) {
 $classCount++;
}
if ($foundNumber) {
 $classCount++;
}
if ($foundSymbol) {
 $classCount++;
}
if ($classCount >= 2) {
 return true;
}
return false;

It would be more important and less error-prone if you have more than three character classes.

Does performance really matter? It seems premature optimization.

Actually, I'd rewrite the last part to a more readable form:

$classCount = 0;
if ($foundLetter) {
 $classCount++;
}
if ($foundNumber) {
 $classCount++;
}
if ($foundSymbol) {
 $classCount++;
}
if ($classCount >= 2) {
 return true;
}
return false;

It would be more important and less error-prone if you have more than three character classes.

typo fix
Source Link
palacsint
  • 30.3k
  • 9
  • 82
  • 157

Does performance really matter? It seems premature optimization.

Actually, I'd rewrite the last part to a more readable form:

$classCount = 0;
if ($foundLetter) {
 $classCount++;
}
if ($foundNumber) {
 $classCount++;
}
if ($foundSymbol) {
 classCount++;$classCount++;
}
if ($classCount >= 2) {
 return true;
}
return false;

It would be more important and less error-prone if you have more than three character classes.

Does performance really matter? It seems premature optimization.

Actually, I'd rewrite the last part to a more readable form:

$classCount = 0;
if ($foundLetter) {
 $classCount++;
}
if ($foundNumber) {
 $classCount++;
}
if ($foundSymbol) {
 classCount++;
}
if ($classCount >= 2) {
 return true;
}
return false;

It would be more important and less error-prone if you have more than three character classes.

Does performance really matter? It seems premature optimization.

Actually, I'd rewrite the last part to a more readable form:

$classCount = 0;
if ($foundLetter) {
 $classCount++;
}
if ($foundNumber) {
 $classCount++;
}
if ($foundSymbol) {
 $classCount++;
}
if ($classCount >= 2) {
 return true;
}
return false;

It would be more important and less error-prone if you have more than three character classes.

Source Link
palacsint
  • 30.3k
  • 9
  • 82
  • 157

Does performance really matter? It seems premature optimization.

Actually, I'd rewrite the last part to a more readable form:

$classCount = 0;
if ($foundLetter) {
 $classCount++;
}
if ($foundNumber) {
 $classCount++;
}
if ($foundSymbol) {
 classCount++;
}
if ($classCount >= 2) {
 return true;
}
return false;

It would be more important and less error-prone if you have more than three character classes.

lang-php

AltStyle によって変換されたページ (->オリジナル) /