PHP class to do basic operations with fractions.
- Plus, minus, multiply, divide
- convert numbers into fractions
- convert fractions into mixed - whole number and fractions
- convert mixed to fractions
- reduce fractions
- get any data - whole number, numerator, denominator. Or frations, full mixed.
Numbers can be in string mode in the following format "3 1/4" or "1/4" or "3";
Methods:
values may be in integers or strings
plus($nr1,$nr2)
minus($nr1,$nr2)
divide($nr1,$nr2)
multiply($nr1,$nr2)
//changes into mixed or fractions or only number
toMixed()
toWhole()
toFractions()
//return as string
getResult()
//return as number
getWhole()
getNumerator()
getDenominator()