mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-06-03 00:50:49 +00:00
For each body should be wrapped in an if statement (#14)
unit test to go with commit
This commit is contained in:
parent
38deaaeb2e
commit
bbbf5cfc9d
|
@ -16,7 +16,9 @@ class Product
|
||||||
{
|
{
|
||||||
$product = 0;
|
$product = 0;
|
||||||
foreach ($a as $index => $value) {
|
foreach ($a as $index => $value) {
|
||||||
$product += $value * $b[$index];
|
if (is_numeric($value) && is_numeric($b[$index])) {
|
||||||
|
$product += $value * $b[$index];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $product;
|
return $product;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user