Hi, have a complex math equation in PHP which is not giving out the correct result. Most likely syntax error as I am new to math in PHP. The variables in the equation are the correct values being entered into a HTML form. Just the result coming out of $maxspl is not correct. Any help appreciated.<?php $sensitivity1 = $_GET['sensitivity']; $maxpower = $_GET['maxpower']; $maxspl = "10" * log10($maxpower/"1") + $sensitivity; //echo $maxspl; ?>
Apologies, I solved my problem above in the end but do have a similar issue with another equation:
150 - 20* log(50/1)
In every calculator I’ve used I get the expected result of 116.02 but whichever way I try and write this equation the answer is never correct.
You can set the base to 10 for the log which will give you 116.02
echo 150-20 * log(50/1, 10); // 116.02059991328
Also, “10” is a character and is NOT 10 …