PHP Salt


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

Version: 2.30.2
Last Build: September 02, 2021 09:55am (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
db
file
graph
html
mail
math
misc
mobile
script
string
system
time
psAryAddition()
Array Addition


Description:

This will mathematically add items to an array




Usage:

psAryAddition($aryMain, $aryAdd);
$aryMain - Main Array
$aryAdd - Array holding items to add



Example:

	$ary['apples'] = 5;
$ary['oranges'] = 2;

$aryAdd['apples'] = 3;

$ary = psAryAddition($ary, $aryAdd);

Results:
$ary['apples'] = 8;
$ary['oranges'] = 2;





Code:

function psAryAddition($aryMain, $aryAdd)
{
foreach ($aryAdd as $key=>$val)
{
$aryMain[$key] += $aryAdd[$key];
}

return $aryMain;
}



Changlelog:

07/15/2021 - function added

See Also

And a shot out to:

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