Kindly refer: PHP Division Float Value Issue
With reference to the Question I have wrote the following code. Can this be done in different way or less code than this.?
The following will help when any of the two given value are lesser than 1 with decimal values. Is this a good practice?
<?php
$First_Value = 0.005;
$Second_Value = 0.1;
// Check the First Value for Decimal
$First_Whole = floor($First_Value); // 0
$First_Fraction = $First_Value - $First_Whole; // .005
// Check the Second Value for Decimal
$Second_Whole = floor($Second_Value); // 0
$Second_Fraction = $Second_Value - $Second_Whole; // .1
// Multiply with 100 becaus ethe decimal is restricted to 3 digit so multiply with 100 works
if(($First_Whole == 0) || ($Second_Whole == 0)){
$First_Value = $First_Value*100; // 0.5
$Second_Value = $Second_Value*100; // 10
}
echo $tableCount = $Second_Value / $First_Value; // 20
?>