private static function roundToNearestIntegerIgnoringTies($amount)
    {
        $relevantDigit = substr(self::roundTowardsZero(bcmul($amount, '10', self::BCSCALE)), -1);

        $result = null;

        switch ($relevantDigit) {
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
                $result = self::roundTowardsZero($amount);
                break;
            case '5':
                $result = null; // handled by tie-breaking rules
                break;
            case '6':
            case '7':
            case '8':
            case '9':
                $result = self::roundAwayFromZero($amount);
                break;
        }

        return $result;
    }
private static function roundToNearestIntegerIgnoringTies($amount)
    {
        $relevantDigit = substr(self::roundTowardsZero(bcmul($amount, '10', self::BCSCALE)), -1);

        $result = null;

        switch ($relevantDigit) {
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
                $result = self::roundTowardsZero($amount);
                break;
            case '5':
                $result = null; // handled by tie-breaking rules
                break;
            case '6':
            case '7':
            case '8':
            case '9':
                $result = self::roundAwayFromZero($amount);
                break;
        }

        return $result;
    }
private static function roundToNearestIntegerIgnoringTies ( $ amount ) { $ relevantDigit = substr ( self :: roundTowardsZero ( bcmul ( $ amount , '10' , self :: BCSCALE ) ) , - 1 ) ; $ result = null ; switch ( $ relevantDigit ) { case '0' : case '1' : case '2' : case '3' : case '4' : $ result = self :: roundTowardsZero ( $ amount ) ; break ; case '5' : $ result = null ; // handled by tie-breaking rules break ; case '6' : case '7' : case '8' : case '9' : $ result = self :: roundAwayFromZero ( $ amount ) ; break ; } return $ result ; }
Round towards the nearest integer, but return null if there's a tie, so specialized methods can break it
differently.

@param string $amount the amount to round

@return string|null
Round towards the nearest integer but return null if there s a tie so specialized methods can break it differently .