trueskill/PHPSkills/Numerics/BasicMath.php

24 lines
373 B
PHP
Raw Normal View History

<?php
/**
* Basic math functions.
*
* PHP version 5
*
* @category Math
* @package PHPSkills
* @author Jeff Moser <jeff@moserware.com>
* @copyright 2010 Jeff Moser
*/
function square($x)
{
return $x * $x;
}
2010-09-30 12:25:31 +00:00
function sum(array $itemsToSum, $funcName )
{
$mappedItems = array_map($funcName, $itemsToSum);
return array_sum($mappedItems);
}
?>