php-ml/src/Phpml/Math/Product.php
2016-04-21 22:12:45 +02:00

26 lines
379 B
PHP

<?php
declare(strict_types = 1);
namespace Phpml\Math;
class Product
{
/**
* @param array $a
* @param array $b
*
* @return mixed
*/
public static function scalar(array $a, array $b)
{
$product = 0;
foreach ($a as $index => $value) {
$product += $value * $b[$index];
}
return $product;
}
}