PHP Salt


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

Version: 2.26.3
Last Build: May 06, 2020 15:29pm (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
db
file
graph
html
mail
math
misc
mobile
script
string
system
time
psAryUpdate()
Updates an array from another array


Description:

Good for updateing an existing array from $_GET array



Usage:

$aryOrig = psAryUpdate($aryDst,$arySrc,$flg=false);

$flg - strict - if you want to update known keys
true: will only update a key in $aryDst if exists
false: all keys are coppied from src to dst



Example:


$aryOrig = psAryUpdate($aryOrig,$_GET);





Code:

function psAryUpdate($aryDst, $arySrc, $flg = false)
{
foreach ($arySrc as $key=>$val)
{
if ($flg == false)
{
$aryDst[$key] = $val;
}
else
{
if ( array_key_exists($key,$aryDst) == true ) {
$aryDst[$key] = $val;
}
}
}
return $aryDst;
}


Changlelog:


See Also

And a shot out to:

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