How can I execute this math operation in PHP? -
i trying operation:
$math = 1.30644 - 1.3063
i want result difference in way:
1.4 (which 64,4 - 63) because dealing pips. how can achieve result.
what tried:
$math = 1.30644 - 1.3063 echo $math; // output -0.3063 want output 1.4
this should want:
$math = 1.30644 - 1.3063; while ($math < 1) { $math *= 10; } var_dump($math); //float(1.4000000000003)
you round result round
function.
it works number:
$math = 64.4 - 63; while ($math < 1) { $math *= 10; } var_dump($math); //float(1.4)
Comments
Post a Comment