Skip to content

unluckychild/PHP-Fractions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP-Fractions

PHP class to do basic operations with fractions.

  1. Plus, minus, multiply, divide
  2. convert numbers into fractions
  3. convert fractions into mixed - whole number and fractions
  4. convert mixed to fractions
  5. reduce fractions
  6. 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()

About

PHP class to do basic operations with fractions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages