diff --git a/README.md b/README.md index 2ee3ae1..ecab842 100644 --- a/README.md +++ b/README.md @@ -1186,12 +1186,12 @@ class Square extends Rectangle { } function renderLargeRectangles($rectangles) { - foreach($rectangle in $rectangles) { + foreach($rectangles as $rectangle) { $rectangle->setWidth(4); $rectangle->setHeight(5); $area = $rectangle->getArea(); // BAD: Will return 25 for Square. Should be 20. $rectangle->render($area); - }); + } } $rectangles = [new Rectangle(), new Rectangle(), new Square()]; @@ -1250,7 +1250,7 @@ class Square extends Shape { } function renderLargeRectangles($rectangles) { - foreach($rectangle in $rectangles) { + foreach($rectangles as $rectangle) { if ($rectangle instanceof Square) { $rectangle->setLength(5); } else if ($rectangle instanceof Rectangle) { @@ -1260,7 +1260,7 @@ function renderLargeRectangles($rectangles) { $area = $rectangle->getArea(); $rectangle->render($area); - }); + } } $shapes = [new Rectangle(), new Rectangle(), new Square()];