Fix php cheatsheet, for loop

iterates over all values, not just n-1 values
This commit is contained in:
Jan Stümmel 2020-01-21 18:57:12 +01:00 committed by GitHub
parent 6c27bf77de
commit e28a4a9cec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ foreach($arr as $key => $value) {
}
// For
for($i = 0; $i < count($arr) - 1; $i++) {
for($i = 0; $i < count($arr); $i++) {
$key = $i;
$value = $arr[$i];
}
@ -338,4 +338,4 @@ class ClassWithLogger
* Use the LoggerAwareTrait in this class.
*/
use LoggerAwareTrait;
}
}