for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace phpbu\App\Util;
/**
* Math Util class
*
* @package phpbu
* @subpackage Util
* @author Sebastian Feldmann <[email protected]>
* @copyright Sebastian Feldmann <[email protected]>
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link https://phpbu.de/
* @since Class available since Release 1.0.0
*/
class Math
{
* Calculates the difference of two values in percent
* @param int $a
* @param int $b
* @return int
public static function getDiffInPercent(int $a, int $b) : int
if ($a > $b) {
$whole = $a;
$part = $b;
} else {
$whole = $b;
$part = $a;
}
return 100 - ceil(($part / $whole) * 100);
return 100 - ceil($part / $whole * 100)
double
integer