the idea of a function is that it is self encapsulating so it won't know what external values are (exceptions ignored for now)
so these two lines are wrong within the function:
$region = $row1['country'];
$amount = $row['price'];
(is that correct for price : $row not $row1 ??)
those values should be assigned outside the function and passed in
//function can go at top of your code so it's available to be called anywhere
function get_taxed_total($region, $amount){
if ($region == 'USA' ){
return ($amount * 13 / 100 + 0.0013 );
} else {
return ( $amount );
}
}
// then way down the script when you need it:
$row1 = $user->getUserData(('country'));
$region = $row1['country'];
$amount = $row['price'];
$mynewamount=get_taxed_total($region, $amount);
I'm not sure about the operator precedence of this line:
$amount * 13 / 100 + 0.0013
I'd add brackets on the sub clauses to make it do everything in the required order