mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-16 01:47:39 +00:00
24 lines
367 B
PHP
24 lines
367 B
PHP
<?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;
|
|
}
|
|
|
|
function sum($itemsToSum, $funcName )
|
|
{
|
|
$mappedItems = array_map($funcName, $itemsToSum);
|
|
return array_sum($mappedItems);
|
|
}
|
|
|
|
?>
|