psPercentAdd() Add a percentage.
Description:
Simple way to add a percentage to a value
Usage:
$val = psPercentAdd($num,$per); $num = a number to add percentage to $per is the percentage, ie: 13.75 percent Note: % sign is optional
Example:
$num = 100.00; $per = 13.75; $val = psPercentAdd($num,$per); // $val will be 113.75
Code:
function psPercentAdd($num,$per) { $per = str_replace("%","",$per); $res = $num + ( $num * ($per / 100) ); return $res; }
Changlelog:
|
|