Skip to content

Commit c058329

Browse files
authored
foreach loop syntax fixed.
does not use "in" syntax, it uses "as"
1 parent cc98962 commit c058329

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,12 +1186,12 @@ class Square extends Rectangle {
11861186
}
11871187

11881188
function renderLargeRectangles($rectangles) {
1189-
foreach($rectangle in $rectangles) {
1189+
foreach($rectangles as $rectangle) {
11901190
$rectangle->setWidth(4);
11911191
$rectangle->setHeight(5);
11921192
$area = $rectangle->getArea(); // BAD: Will return 25 for Square. Should be 20.
11931193
$rectangle->render($area);
1194-
});
1194+
}
11951195
}
11961196

11971197
$rectangles = [new Rectangle(), new Rectangle(), new Square()];
@@ -1250,7 +1250,7 @@ class Square extends Shape {
12501250
}
12511251

12521252
function renderLargeRectangles($rectangles) {
1253-
foreach($rectangle in $rectangles) {
1253+
foreach($rectangles as $rectangle) {
12541254
if ($rectangle instanceof Square) {
12551255
$rectangle->setLength(5);
12561256
} else if ($rectangle instanceof Rectangle) {
@@ -1260,7 +1260,7 @@ function renderLargeRectangles($rectangles) {
12601260

12611261
$area = $rectangle->getArea();
12621262
$rectangle->render($area);
1263-
});
1263+
}
12641264
}
12651265

12661266
$shapes = [new Rectangle(), new Rectangle(), new Square()];

0 commit comments

Comments
 (0)