PHP Salt


A little dash of PHP... my collection of php functions

Version: 2.33.2
Last Build: December 29, 2023 20:28pm (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
db
file
graph
html
mail
math
misc
mobile
script
string
system
time
web
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:



See Also

And a shot out to:

PHP - php.net
Fedora Server - getfedora.com
Shameless ads to pay for site