function mortgage_calculator($loan, $time, $apr = 5)
is that right? i have the function returning $apr as if its 0 every time i dont set it in the form.
i have tried googling but the examples i have seen show this to be correct 😕
Yes, that's correct. If you have any doubt, make a test:
function test($arr = 5) { return $arr; } var_dump( test() );
So, somewhere in the function you're changing its value, or else you're supplying a different initial value for it.
i was using
$var = mortgage calulator($_POST['amount'], $_POST['time'], $_POST['apr'])
with no isset for the apr. thats why its value kept nullifying itself. groovy
So... does it work now? If so, don't forget to mark this thread resolved.