For each body should be wrapped in an if statement (#14)

unit test to go with commit
This commit is contained in:
Pablo Joán Iglesias 2016-07-26 02:14:57 -04:00 committed by Arkadiusz Kondas
parent 38deaaeb2e
commit bbbf5cfc9d

View File

@ -16,7 +16,9 @@ class Product
{
$product = 0;
foreach ($a as $index => $value) {
$product += $value * $b[$index];
if (is_numeric($value) && is_numeric($b[$index])) {
$product += $value * $b[$index];
}
}
return $product;