underscore-php
underscore-php copied to clipboard
add Float type, with stuff that twig_round does
function twig_round($value, $precision = 0, $method = 'common')
{
if ('common' == $method) {
return round($value, $precision);
}
if ('ceil' != $method && 'floor' != $method) {
throw new Twig_Error_Runtime('The round filter only supports the "common", "ceil", and "floor" methods.');
}
return $method($value * pow(10, $precision)) / pow(10, $precision);
}
Why not to add this:
Float::ceil($float, $precision)
Float::floor($float, $precision)