I have array of three elements:
- integer
- numerator
- denominator
How without stupid ways convert wrong fraction to normal?
Example: [1, 7, 4] -> [2, 3, 4]. Numerator/denominator.
I have array of three elements:
How without stupid ways convert wrong fraction to normal?
Example: [1, 7, 4] -> [2, 3, 4]. Numerator/denominator.
Try this, if this is what your wanting.
<?php
function cleanFraction($value , $numerator , $denominator)
{
while($numerator >= $denominator)
{
$numerator -= $denominator;
$value++;
}
return array($value , $numerator , $denominator);
}
?>