I am relatively new to PHP code and I am having trouble turning a piece of custom PHP form code into a PHP function.

I am trying to pass two form variables into the function ($var and $fee) and then use those variables to return the new calculated fee ($newfee). My code is trying to say that if $var is set to 'Y' then I need to deduct $3.00 from $fee, so here is my function:

<?php
function feeValue ($var,$fee) {
if ($var == 'Y') {
$newfee = $fee 3.00';
} else {
$newfee = $fee;
}
return $newfee;
}
?>


I then put this function into a separate PHP file and require or include it in my form. Then I insert the results of the calculation return code code back to my PHP form to set the calculated value of $newfee as follows:

$fee = feeValue($newfee);

However when I try to submit the form all I get is a blank page, which I guess is telling me there is something wrong with my PHP function code, or perhaps the way I am returning the value.

Note that if I use the code in my PHP function and insert it direct to the form (i.e. just the if/else statement) then all works fine as I want. However I specifically wish to use PUP functions in cases like this, so can anyone help me out here please and point me in the right direction??

Many Thanks, PaulB