diff --git a/src/Phpml/Math/Product.php b/src/Phpml/Math/Product.php index 70accb9..678dd71 100644 --- a/src/Phpml/Math/Product.php +++ b/src/Phpml/Math/Product.php @@ -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;