mtownsend
11/15/2018 - 7:42 PM

percentage_of_number

Take a number and percentage and figure out what number the percentage translates into.

<?php

if (!function_exists('percentage_of_number')) {
    /**
     * Take a number and percentage and figure out what number the percentage translates into.
     *
     * @param mixed (float/int) $originalNumber
     * @param mixed (float/int) $percentage
     * @return float
     */
    function percentage_of_number($originalNumber, $percentage)
    {
        return (float) round(($originalNumber / 100) * $percentage, 2);
    }
}